Taking input and Outputting it backwards
I'm not sure what the problem is here, but I can get the program to produce, "Hello" as "olleH" but when I type something like,
"Hello my nick is whtpirate" I only get "olleH" what seems to be the problem ? I would appreciate help thank you :)
Code:
#include <stdio.h>
// Take user input and Output it backwards.
int a;
char choice[200];
int main()
{
// Gotta put my little plug in there as usual :)
printf("\n Text reverser; Coded by whtpirate(elder(justin)) of LogiTeam.\n");
puts("\n");
// Begin Main;
printf("\tPlease enter a string: ");
scanf("%199s", choice);
for (a = strlen(choice) + 1; a != -1; a--) // This should make the text go backwards.
{
printf("%c", choice[a]);
}
return 0;
}