我有以下代码:
int atoi(const char * str)
{
int ret = 0, i;
if (str) {
for (i = 0; str[i] != '\0'; i++)
if (str[i] >= '0' && str[i] <= '9')
ret = ret * 10 + str[i] - '0';
}
return ret;
}
Run Code Online (Sandbox Code Playgroud)
当试图编译它时
fug@fugtop ~/p/book> make
gcc -c -o db.o db.c -Wall -Werror -std=c99 -g -DVERSION=\"v0.4\" -Wno-
unused-variable -Wno-unused-function
gcc -c -o misc.o misc.c -Wall -Werror -std=c99 -g -DVERSION=\"v0.4\" -
Wno-unused-variable -Wno-unused-function
misc.c: In function ‘atoi’:
misc.c:55:5: error: …
Run Code Online (Sandbox Code Playgroud)