void dtoc(long a, char str[]);
int main()
{
long intg;
char istr[20];
for(int i=0; i<20; i++)
istr[i] = '\0';
printf("Please input a long integer:");
scanf("%d", &intg);
dtoc(intg, istr);
printf("%s\n", istr);
return 0;
}
void dtoc(long a, char str[])
{
static int t=0;
if(a > 0)
{
dtoc(a/10, str);
str[t++] = a%10 + '0';
}
else if(a == 0)
{
str[t] = '0';
return;
}
else
{
str[t++] = '-';;
a = -a;
dtoc(a, str);
}
}