简单的c语言检错

来源:百度知道 编辑:UC知道 时间:2024/05/30 07:51:17
#include "stdio.h"
int fun(int b)
{int c;
c=b%10;
printf("%d\t",c);
b=b/10;
return b;
}
void main()
{
int a,b;
printf("请输入");
scanf("%d",&a);
b=a;
while(b!=0)
fun(b);
}
帮我看看有什么错误!
我想输入一个数,以字符形式逆向输出

你的b没有返回来,加上b=fun(b)就对了
#include "stdio.h"
int fun(int b)
{int c;
c=b%10;
printf("%d\t",c);
b=b/10;
return b;
}
void main()
{
int a,b;
printf("请输入");
scanf("%d",&a);
b=a;
while(b!=0){
b=fun(b);
}
}