void main() in C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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
2 Answers
+ 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