atoi()函数实现 atoi()函数说将字符串转换为int数字 在进行函数实现时要考虑以下几种异常情况: 字符串为空 字符串前面有空格要忽略 判断正负号 由于atoi()返回值为int类型,要注意上下界溢出判断 异常字符跳出 以下为代码实现 int my_atoi(const char* str) { long long ret = 0; //字符串为空 if (str ==