1、
#include <stdio.h> void put(char x[]) { int len = 0; while(x[len]) len++; while(len-- > 0) { putchar(x[len]); } } int main(void) { char str[128]; printf("str: "); scanf("%s", str); put(str); return 0; }
2、
#include <stdio.h> void put(char x[]) { int len = 0; while(x[len]) len++; int i = 0; while(x[i]) { putchar(x[len - 1 - i]); i++; } } int main(void) { char str[128]; printf("str: "); scanf("%s", str); put(str); return 0; }
3、
#include <stdio.h> void put(char x[]) { int len = 0; while(x[len]) len++; char tmp[len]; int i = 0; while(x[i]) { tmp[i] = x[len - 1 - i]; i++; } for(i = 0; i < len; i++) { x[i] = tmp[i]; } i = 0; while(x[i]) putchar(x[i++]); } int main(void) { char str[128]; printf("str: "); scanf("%s", str); put(str); return 0; }
4、
#include <stdio.h> void put(char x[]) { int len = 0; while(x[len]) len++; int i; for(i = 0; i < len / 2; i++) { int tmp = x[i]; x[i] = x[len - 1 - i]; x[len - 1 - i] = tmp; } i = 0; while(x[i]) putchar(x[i++]); } int main(void) { char str[128]; printf("str: "); scanf("%s", str); put(str); return 0; }
5、
#include <stdio.h> void put(char x[]) { int len = 0; while(1) { if(x[len] == '