Is c function prototype mismatch merely a warning

后端 未结 2 494
甜味超标
甜味超标 2020-12-19 23:23

please take a look at my codes below

#include 

void printOut()
{
 static int i = 0;
 if (i < 10)
 {
  printOut(i);
 }
}

int main(int argc         


        
2条回答
  •  执笔经年
    2020-12-20 00:07

    In C, a function without any parameters can still take parameters.

    That's why it compiles. The way to specify that it doesn't take any parameters is:

    void printOut(void)
    

    This is the proper way to do, but is less common especially for those from a C++ background.

提交回复
热议问题