mpNum2Str ´Ù¹èÀå Á¤¼ö¸¦ ¼ö¿·Î º¯È¯ÇÑ´Ù
void mpNum2Str(char *str, int *num);
str (Ãâ·Â) ´ëÀÀÇÑ ¼ýÀÚ¿ num (ÀÔ·Â) ´Ù¹èÀå Á¤¼ö
¾øÀ½
#define N 10000
void mpNum2Str(char *str, int *num)
{
int i, j;
char *ss;
int x;
if (*num == 0) {
*str++ = '0';
*str = '\0';
return;
}
ss = str - 1;
for (i = *num; i > 0; i--) {
x = *++num;
for (j = 1; j < N; j *= 10) {
*++ss = x % 10 + '0';
x /= 10;
}
}
while (*ss == '0') ss--;
*(ss + 1) = '\0';
while (str < ss) {
x = *str;
*str++ = *ss;
*ss-- = x;
}
}