void main()can not run | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

void main()can not run

6th Mar 2017, 7:44 AM
nihao
3 Answers
+ 5
In C++, main function should NEVER return a void. Always make it return an int (or some other stuff depending on the case). This is to ensure that your main can start properly, and end properly. Also mainly to prevent bugs. Google and readup about it more.
6th Mar 2017, 8:47 AM
Wen Qin
Wen Qin - avatar
- 1
in sometimes the void main()can run and why?
6th Mar 2017, 11:07 AM
nihao
- 2
There is no hard and fast rule about not returning void in main(). What is the programme anyway? There must be some other error.
6th Mar 2017, 9:07 AM
Rohan
Rohan - avatar