#include
int main(void)
{
char s[7];
int k;
void split(int,char *);
printf("Please input a Integer( Range:-32768 to 32767 ):");
scanf("%d",&k);
split(k,s);
printf("%s\n",s);
return 0;
}
void split(int t,char *ps)
{
int i;
char *q=ps,tmp;
if (t>0)
*ps++='+';
if (t<0)
{
*ps++='-';
t=-t;
}
/*------------Found Mistake Below------------*/
while(t/10!=0)
{
i=t/10;
*ps++='0'+t-i*10;
t=i;
}
*ps++='0'+t;
*ps='\0';
/*------------Found Mistake Below------------*/
for(q++,ps--;q
}
//已经测试通过,希望能帮到你!