c语言 用递归反序输出字符

#include<stdio.h>
void reverse (int c,char a[]);
void main()
{int b=0;
char a[50];
gets(a);
reverse(b,a);
}
void reverse (int c,char a[])
{
if(a[c]!='\0')
{
reverse(c+1,a);
printf("%c",&a[c]);
}
else return;
}

把 “printf("%c",&a[c]);”改成“printf("%c",a[c]);”

注意&的区别。
温馨提示:答案为网友推荐,仅供参考
相似回答
大家正在搜