Return vs. exit in main() [WAS Re: "exit 0;" - or - "exit (0);" ?]

Doug Gwyn gwyn at brl-smoke.ARPA
Sat Nov 22 08:45:41 AEST 1986


In article <2330 at diamond.Diamond.BBN.COM> mlandau at Diamond.BBN.COM (Matt Landau) writes:
>Does the most recent ANSI draft have anything to say on this subject?

Yes.  main() is an int-valued function; its return value is used the same
way as it would have been if termination were achieved by invoking exit()
with the same value as a parameter.  If you don't return anything, the
termination status is undefined, as one would expect.



More information about the Comp.lang.c mailing list