+ 1
Can void main be used in place of int
4 Antworten
+ 6
Some compilers will allow it, but it goes against the C++ standards, so you should never do it. Your main function should always return an integer.
http://www.stroustrup.com/bs_faq2.html#void-main
+ 1
I dont think so as a compiler will insert return int if it is left out of your code (not 100% on this one though)
0
What for? The return of main is used to send signals to the caller (OS). It is a way for your program to communicate with the system, for example, to report errors. Just because most people don't understand it, it does not mean it is useless.