+ 1

"return 0;" not used...

C++=>More on Classes=>Selection Operator=>3rd Quiz;

5th Jul 2018, 4:53 PM
Master
6 Answers
+ 1
Compilers will insert it in main if missing. But yes, technically you need a return there
5th Jul 2018, 5:16 PM
Matthias
Matthias - avatar
+ 1
If you try to compile that code it will run any how. actually when program exit main and encountered no return statement it will return 0 by default. so its perfectly fine in that way too.
5th Jul 2018, 5:19 PM
Yugabdh
Yugabdh - avatar
+ 1
https://stackoverflow.com/questions/204476/what-should-main-return-in-c-and-c this is great thread available at stack if you think u want more info.
5th Jul 2018, 5:20 PM
Yugabdh
Yugabdh - avatar
0
Can you post that code here. It might help :)
5th Jul 2018, 4:58 PM
Yugabdh
Yugabdh - avatar
0
Well... its actually kind of mistake... In Selection Operator's 3rd Quiz, It says: int main(){ _______ obj; ______._______; }//<=No return 0; used here
5th Jul 2018, 5:02 PM
Master
0
Ok. Thanks.
5th Jul 2018, 5:22 PM
Master