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

What is the difference between int main() and main() ?

14th Jun 2017, 2:26 PM
Indranil Mondal
Indranil Mondal - avatar
3 Answers
+ 15
if you are working with C, main() works but is confusing, in C the main function always returns an int, to specify exit status, so the correct syntax is int main(), but if you do not bother to set the exit status then main() is enough, but I don't know the good C books always use into main()
14th Jun 2017, 3:15 PM
Corne
Corne - avatar
+ 4
both are same ...... both return the integer type value ....int main() .....here int says all ....and in main() ...you should know that by default main() returns integer type value ....
14th Jun 2017, 3:09 PM
#Happy@777
#Happy@777 - avatar
+ 2
It's all about standard and good habits ^^It is recommended to write int main() with return 0; at the end.
14th Jun 2017, 3:19 PM
Jakub Stasiak
Jakub Stasiak - avatar