我目前正在编写一本书中的挑战问题的代码。我的代码执行完美,并输出正确的结果,但是我在我的代码中收到了一个警告信息,我想知道为什么。
我在以下这行代码上收到了警告:
int countdownStart = atoi(numInput);
我遇到的警告是:
隐式声明函数'atoi'在C99中无效。
#import <readline/readline.h>
#import <stdio.h>
int main(int argc, const char * argv[]){
printf("Who is cool? ");
const char *name = readline(NULL);
printf("%s is cool!\n\n", name);
printf("What should I start counting? ");
const char *numInput = readline(NULL);
int countdownStart = atoi(numInput);
for (int i = countdownStart; i >= 0; i--){
if (i % 3 == 0){
printf("%d\n", i);
if (i % 5 == 0){
printf("Found one!\n");
}
}
}
return 0;
}