Return 0 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Return 0

If you begin with " int main" does the compiler automatically fill in " return 0" at the end? I know it works on sololearn but does it work when you are creating actual programs from scratch?

7th May 2019, 10:32 PM
Kevin Hoover
Kevin Hoover - avatar
2 Answers
+ 7
Yep `return 0` is automatically returned for you if you don't do it. That only works for the main function though.
7th May 2019, 11:01 PM
Schindlabua - avatar
+ 5
I don't believe so but maybe this is compiler dependent. E.g. on code playground it seems to work without return.
7th May 2019, 10:42 PM
Sonic - avatar