#include <stdio.h> void strf(char *a) { if(!*a) return; strf(a+1); putchar(*a); } int main(void) { char a[20]; gets(a); strf(a); getch(); return 0; }
本人来个不递归 #include <stdio.h> #define N 100 void f (char *p, int n) { char *q, s; q = p + n; while (p < q) s = *q, *q = *p, *p = s, -- q, ++ p; } int main () { char a[N]; while (scanf ("%s",a)) f (a, strlen (a) - 1), puts (a); getch (); return 0; }