小编rya*_*yan的帖子

为什么在C中声明具有int返回类型的函数不是强制性的?

int main ()
{
hello();

return 0;
}

int hello()
{

printf("\n hello world");

return 0;
}
Run Code Online (Sandbox Code Playgroud)

根据C规则,下面定义的每个函数main()必须在上面声明,main() 但为什么它int作为返回类型的函数的异常?如果你将返回类型hello() 改为其他任何东西(void,char*等),它将抛出错误声明.为什么int 返回类型没有错误或警告?

c function forward-declaration function-declaration

0
推荐指数
1
解决办法
102
查看次数