#include <stdio.h>
void fun();
int main(void) {
fun(fun());
return 0;
}
void fun()
{
printf("function is called");
}
函数fun的返回类型是void。所以下面的语句应该是有效的,对不对!但是编译器会提出编译错误,因为函数fun的返回类型是void。
fun(fun())
但编译器却提出了编译错误,原因是 错误:参数类型'void'不完整。. 无法理解该错误的含义?
我想你要的是这样的东西。
#include <stdio.h>
int fun(int arg); // function takes one argument
int main(void) {
fun(fun(1)); // use one argument when calling fun
return 0;
}
int fun(int arg)
{
printf("function is called\n");
return 0;
}