+ 1

void main() in C++

Correct me if I’m wrong, in C++, void main() doesn’t exist, but you can still use int main without returning a value. Does this mean that void main() is somewhat “included” in the int main()?

1st Mar 2019, 9:21 PM
Francisco J. Rosario
Francisco J. Rosario - avatar
3 Réponses
+ 2
//Here is a relevant thread, that gives you best answer https://www.sololearn.com/Discuss/1225/?ref=app
1st Mar 2019, 9:31 PM
Sudarshan Rai
Sudarshan Rai - avatar
+ 2
Just adding one more link on the compiler adding the return statement for main() if you do not write it explicitly. http://www.stroustrup.com/bs_faq2.html#void-main
2nd Mar 2019, 7:28 AM
Hatsy Rei
Hatsy Rei - avatar