+ 1

How to print XYZ in reverse in c language

C language

9th Oct 2020, 7:18 AM
Lovepreet Singh
Lovepreet Singh - avatar
2 ответов
+ 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);
10th Oct 2020, 1:51 AM
Paul K Sadler
Paul K Sadler - avatar