char intToStr(int a)
{
int n, i, j, sign, set;
char r[10], s[10];
if (a[0] == '-')
sign = -1;
if (sign == -1)
{
i = 1;
n = a % 10;
s[i++] = n | '0';
a = a / 10;
}
else
{
i = 0;
n = a % 10;
s[i++] = n | '0';
a = a / 10;
}
i--;
while (i >= 0)
{
r[j++] = s[i--];
}
return r;
}
i m the beginer of c programing language
i have doubt at the time of handling of negative numbers at the time of covertng to string
{
int n, i, j, sign, set;
char r[10], s[10];
if (a[0] == '-')
sign = -1;
if (sign == -1)
{
i = 1;
n = a % 10;
s[i++] = n | '0';
a = a / 10;
}
else
{
i = 0;
n = a % 10;
s[i++] = n | '0';
a = a / 10;
}
i--;
while (i >= 0)
{
r[j++] = s[i--];
}
return r;
}
i m the beginer of c programing language
i have doubt at the time of handling of negative numbers at the time of covertng to string
Comment