no return type in main() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

no return type in main()

here there is no "return 0" in main function

1st Nov 2016, 2:12 PM
Mohi
Mohi - avatar
3 Answers
+ 2
By Default the return type of main() function is int . So you have to return 0 . Or there will be showing an error.
27th Nov 2016, 7:12 AM
rohit bisht
rohit bisht - avatar
+ 2
Apart from that its special function and all other functions are finally ending up there and vice versa so typing return 0 is not necessary in some compilers or ###### compiler will complain: ###### RETURN TYPE ERROR IN MAIN()
27th Nov 2016, 1:06 PM
Mohi
Mohi - avatar
0
return 0 in the main function isn't always needed but you should use it to make sure 0 is returned and an error did not come up.
1st Nov 2016, 2:18 PM
nedas
nedas - avatar