[NTLUG:Discuss] OT: C question
anindya Chakraborty
anindya.links at gmail.com
Wed May 10 17:56:09 CDT 2006
On 5/10/06, Fred James <fredjame at fredjame.cnc.net> 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?
are you having the declaration of main as int main() ? if the return time is
main then you should not have any problem with returning 0 with return(0).
But, exit causes the program to end and supplies a status code to the
calling environment.
Hope it helps,
bye
anindya
More information about the Discuss
mailing list