Hi Guys, Happy New Year to all of you!! I wrote the following code to reverse a string input from user. I'm wondering if there is a better way to go about this. Any suggestions please?
Code:int main() { char string[256]; int len; printf("Enter a string:\n"); fgets(string, 256-1, stdin); len = (strlen(string) - 1); printf("You entered %s \nlength %d:\n", string, len); printf("Reverse string:"); for(; len >= 0; len--) printf("%c",string[len]); printf("\n"); exit(0); }