[NTLUG:Discuss] OT: C question
Fred James
fredjame at fredjame.cnc.net
Wed May 10 17:16:22 CDT 2006
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
More information about the Discuss
mailing list