1 #include <stdio.h> 2 void reverse(char s[]) 3 { 4 int len; 5 len = strlen(s); 6 7 if (len == 1) 8 { 9 printf("%c", s[0]); 10 } 11 else 12 { 13 reverse(s + 1); 14 printf("%c", s[0]); 15 } 16 } 17 main() 18 { 19 char s[100]; 20 21 printf("input your string:\n"); 22 scanf("%s", s); 23 reverse(s); 24 }
原文:https://www.cnblogs.com/20201212ycy/p/14698034.html