I'm doing an excercise in a book I bought, but I figured I'd go an extra mile. And i'm having a lot of trouble in getting this to work. Here is what I have (the part that works.)
Now, what I want to be able to do, is to store the 'backwards' string in a seperate array, so that I end up with the 'backwards' string in an entirely different array than str. I've tried various loops, but I can't seem to get it to work :/Code:#include <stdio.h> #include <string.h> int main(void) { char str[80]; int i; printf("Enter a string: "); fgets(str, sizeof(str), stdin); for (i = strlen(str); i>-1; i--) printf("%c", str[i]); printf("\n"); return 0; }



LinkBack URL
About LinkBacks


