mpStr2Num 数列を多倍長整数に変換する
void mpStr2Num(int *num, char *str);
num (出力)変換された多倍長整数 str (入力)数字列
なし
#define N 10000 void mpStr2Num(int *num, char *str) { char *ss; int *nn; int k; int x; while (*str == ' ' || *str == '\t') str++; while (*str == '0') str++; ss = str; while (*ss >= '0' && *ss <= '9') ss++; if (ss == str) { *num = 0; return; } x = 0; k = 1; nn = num; do { x += (*--ss - '0') * k; k *= 10; if (k == N || ss == str) { *++nn = x; x = 0; k = 1; } } while (ss != str); *num = nn - num; }