int chartoint(const char str) int n=chartoint("123456"); 输出n为123456
int chartoint(const char *str) { int rst = 0; while (*str) { rst = rst * 10 + (*str++ - '0'); } return rst; }