[NTLUG:Discuss] OT: C question

Stuart Yarus syarus at kvsystems.org
Wed May 10 20:41:03 CDT 2006


Hi,

Just checking...  have you included the stdlib.h header?

Stuart



Fred James wrote:
> All
> I have a C program that if compiled with a "return (0);" as the last 
> line in main(), runs correctly but give a "Bus error(core dump)" message.
> If I compile the same C program with a "exit (0);" as the last line in 
> main(), the run is also correct, and there is no error message.
> 
> What is the difference, please?
> 
> K&R says: "Within main, return expr is equivalent to exit(expr).  (page 
> 164, paragraph 2, "The C Programming Language - Second Edition" by Brian 
> W. Kernighan, Dennis M. Ritchie, Prentice Hall Software Series, 
> Copyright 1988, 1978, by Bell Telephone Laboratories, Incorporated).
> 
> The platform is SGI IRIX 6.4
> 
> Thank you in advance for any help you may be able to offer
> Regards
> Fred James
> 
> _______________________________________________
> http://ntlug.pmichaud.com/mailman/listinfo/discuss
> 






More information about the Discuss mailing list