【发布时间】:2013-05-09 18:31:33
【问题描述】:
为什么会有这段代码:
strcmp(myfunction(0), "OK");
myfunction 的定义如下:
char *myfunction(int p)
{
if (p == 0)
{
return("OK");
}
}
给出以下错误:
warning: passing argument 1 of 'strcmp' makes pointer from integer without a cast
【问题讨论】:
-
myfunction()是在你调用它之前声明的吗? -
您在调用它之前忘记声明
myfunction。这已经被问了数百万次了。根据您的错误消息进行搜索会为同一问题提供大量答案。