+ 1
How to print XYZ in reverse in c language
C language
3 Answers
+ 2
Here is an example
char word [50];
fgets(word, 50, stdin);
int wordLen = strlen(word);
for(int i=0; i<wordLen/2; i++)
{
char character = word[i];
word[i] = word[wordLen -i -1];
word[wordLen -i -1] = character;
}
printf("%s",word);