1. 程式人生 > >字串轉換為整數的原始碼atoi()

字串轉換為整數的原始碼atoi()

#define is_digit(c)((c) >= '0' && (c) <= '9')

static int skip_atoi(const char **s)

{

int i=0;

while (is_digit(**s))

i = i*10 + *((*s)++) - '0';

return i;

}