What is difference between void main and main? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is difference between void main and main?

4th Sep 2016, 7:23 AM
Dixit Parkhiya
Dixit Parkhiya - avatar
3 Answers
+ 3
main is just name of the function that gets executed at first. Void means it doesn't return anything to the OS. We mostly return 0 in main because it gives message to the OS that the program ran successfully and there was no problem in its execution.
4th Sep 2016, 10:11 AM
Shark riding Astronaut
Shark riding Astronaut - avatar
+ 2
nothing
4th Sep 2016, 9:37 AM
Kandarp Singh
Kandarp Singh - avatar
- 1
void main is mostly use in c ; main is mostly use in c++; may vise versa usage will make compile error
4th Sep 2016, 8:33 AM
sai