main() returning void

Apr 19, 2013 at 1:50am
I was asked the other day why it was a bug or problem that main() returned void instead of int. I had no clue other than when returning an int you get information about possible errors occurred during the program execution.
Can anyone provide more info on this?
Many thanx
Apr 19, 2013 at 1:57am
The standard requires that main return an int.
That's the crux of the issue.
Apr 19, 2013 at 3:42pm
thanx
i know std c++ requires an int return from main. the question is more like why it is enforced by std c++ to return an int.
Apr 19, 2013 at 3:48pm
http://www.stroustrup.com/bs_faq2.html#void-main

i know std c++ requires an int return from main. the question is more like why it is enforced by std c++ to return an int.
main() is a special case, you are not forced to return anything (that implies return 0;).
Topic archived. No new replies allowed.