When do you #include <stdlib.h>?
Rodrigo Murillo
murillo at sigi.Colorado.EDU
Tue Mar 22 10:18:01 AEST 1988
I realized today that you can call functions that are in stdlib.h
without actually including them in your file. But on the otherhand
you can include them. Is there a hard fast rule? Let me give an
example:
printf("foo: %dl",atol(argv[1]));
The prototype for atol() resides in stdlib.h. The above code compiles
without an #include <stdlib.h>, but the expresion yields rubbish. When
the stdlib.h is included, it works fine. What gives? Why doesn't the
compiler barf when it encounters atol() when the stdlib.h is NOT included?
--
_______________________________________________________________________________
Rodrigo Murillo, University of Colorado - Boulder (303) 761-0410
murillo at boulder.colorado.edu | ..{hao|nbires}!boulder!murillo
( Machines have less problems. I'd like to be a machine. -- Andy Worhol )
More information about the Comp.lang.c
mailing list