
各位看看这题,编写一个递归函数,不是很会
你题目的解答代码如下:
#include <stdio.h>
#include <string.h>
void re(char s[], int a,int b)
{
if (a<b)
{
char t = s[a];
s[a] = s[b];
s[b] = t;
re(s,a+1,b-1);
}
}
int main()
{
int t,i;
char s[51];
gets(s);
re(s,0,strlen(s)-1);
printf("%s\n", s);
return 0;
}
如有帮助,望采纳!谢谢!