Not including stdlib.h does not produce any compiler error!

前端 未结 5 1196
太阳男子
太阳男子 2020-12-11 08:33

Hopefully this is a very simple question. Following is the C pgm (test.c) I have.

#include 
//#include 

int main (int argc,          


        
5条回答
  •  攒了一身酷
    2020-12-11 08:49

    C allows you to call a function without having a declaration for that function.

    The function will be assumed to return an int and arguments will be passed using default promotions. If those don't match what the function actually expects, you'll get undefined behavior.

    Compilers will often warn for this case, but not always (and that will also depend on compiler configuration).

提交回复
热议问题