Implicit declaration in C

倾然丶 夕夏残阳落幕 提交于 2019-12-04 11:13:27

Yes it does. Not having a declaration in scope is UB.

J.2 Undefined behavior

— For call to a function without a function prototype in scope where the function is defined with a function prototype, either the prototype ends with an ellipsis or the types of the arguments after promotion are not compatible with the types of the parameters (6.5.2.2).

Also, note that falling off main is okay in C99 (i.e. semantically equivalent to a return 0;). For pre-C99 compliant compilers you need a return statement where the return type of the main function is a type compatible with int.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!