C语言反转字符串输出,要求使用递归算法实现。不用递归很简单,可是用递归怎么实现呢?
2条回答 默认 最新
- threenewbee 2015-12-12 06:54关注
#include <stdio.h> void foo(char * s) { if (*s != '\0') foo(s + 1); printf("%c", (char)*s); } int main() { char s[] = "hello world"; foo(s); }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 2无用