c语言张泳
发布时间: 2022-08-11 08:59:03
A. 求大佬解决这到c语言题,指出哪里有错误,帮我写一下正确的程序,万分感谢QAQ
#include<stdio.h>
#defineMAXN10
voidf(longintx,char*p);
intmain()
{longintx;
chars[MAXN]="";
scanf("%ld",&x);
f(x,s);printf("%s
",s);
return0;
}
voidf(longx,char*s)
{
inti=0,j=0,c;
if(x<0){s[0]='-';x=-x;i=j=1;}
do{
s[i]=x%16;
s[i]+=s[i]<10?48:55;
i++;
x/=16;
}while(x>0);
s[i]='