Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

main can't be void [duplicate]

Tags:

c++

syntax

Possible Duplicate:
does c++ standard prohibit the void main() prototype?

Why is C++ not letting me do void main()? It's not much of a problem, but I'm still curious.

like image 287
calccrypto Avatar asked Sep 30 '10 13:09

calccrypto


1 Answers

Because return type of main()(as mandated by the Standard) must be int

C++03 [Section 3.6.1 Main function]

An implementation shall not predefine the main function. This function shall not be overloaded. It shall have a return type of type int, but otherwise its type is implementation-defined.

like image 196
Prasoon Saurav Avatar answered Sep 28 '22 06:09

Prasoon Saurav