1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #include<ctype.h> 5 6 void reverse(char *str); 7 8 int main() 9 { 10 char str[128]; 11 while(gets_s(str,128) != NULL) 12 { 13 //deleteSpace(str); 14 reverse(str); 15 puts(str); 16 } 17 system("pause"); 18 return 0; 19 } 20 21 22 void reverse(char *str) 23 { 24 int beg = 0; 25 int end = strlen(str)-1; 26 char temp; 27 while(beg < end) 28 { 29 temp = str[beg]; 30 str[beg] = str[end]; 31 str[end] = temp; 32 beg++; 33 end--; 34 } 35 }