Function without return type specified in C

后端 未结 3 648
情深已故
情深已故 2020-11-30 10:38

I came across this piece of code in C:

#include 
main( )
{
 int i = 5;
 workover(i);
 printf(\"%d\",i);
}
workover(i)
int i;
{
 i = i*i;
 retu         


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-30 11:14

    The function declaration syntax was used in older versions of C, and is still valid, so the code fragment "workover(i) int i;" is equivalent to "workover(int i)". Although, I think it may still generate warnings or even errors, depending on what compiler options you use.

提交回复
热议问题