Mail Archives: djgpp/1996/07/17/22:31:02
On Tue, 16 Jul 1996, Nissim Chudnoff wrote:
> A while ago, there was a conversation about 'void main()' vs. 'int main()'
> and I wondered if:
>
> void main()
> {
> exit(1);
> }
>
> Is the same as
>
> int main()
> {
> return(1);
> }
No it's not. The first method (at least, when I tested it under Linux)
would return a random, nonzero (but small magnitude) positive integer,
i.e. 2. This is normally used to signal an error condition so it's a bad
idea to declare void main().
--
Orlando Andico http://gibson.eee.upd.edu.ph/~orly/
orly AT gibson DOT eee DOT upd DOT edu DOT ph "Who knows what's going to happen,
IRC Lab/EE Dept/UP Diliman lottery or car crash, or you'll join a cult."
- Raw text -