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; } }