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

前端 未结 5 1198
太阳男子
太阳男子 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 09:02

    If you don't specify otherwise, I believe a C compiler will just guess that undeclared functions take the form extern int foo(). Which is why atoi works and atof doesn't. Which compiler flags were you using? I suggest using -Wall to turn on a bunch of gcc warnings, which should include referencing undeclared functions.

提交回复
热议问题