What is the main difference in main() and void main()? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is the main difference in main() and void main()?

3rd May 2017, 1:49 PM
HiRo
HiRo - avatar
3 Answers
+ 3
yeah ... i wanted to know that if we do not use void function... then what happens
3rd May 2017, 1:56 PM
HiRo
HiRo - avatar
+ 4
It's all about return type. main() return int by default. void main doesn't return any value out of main() function.
3rd May 2017, 1:53 PM
Bilal E
Bilal E - avatar
+ 2
If you don't put a void or any data type before it . Depending on the c standard which is used compiler will either replace the empty main as int main or it will show a error asking u to change the main to int main.Depends on the ....c standards
3rd May 2017, 5:10 PM
Nantha
Nantha - avatar