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

Return 0

Please helppp In c++, When we say return 0 it means to execute the program regardless of the error it might have , what does it do when the program has error ?

31st Oct 2019, 7:33 AM
Armina
Armina - avatar
6 Answers
+ 4
Armina Generally, a program returns non zero value to indicate that it encounters an event where it cannot proceed with whatever it is doing previously. And contrary (just before the main function ends) program can return zero, to indicate that whatever it does had succeeded, up to the point where the main function is about to end (thus program ends). Read more details about return value of main function in the following links: [Proper declaration of main function] https://stackoverflow.com/questions/4207134/what-is-the-proper-declaration-of-main [Return value of main function in C/C++] https://stackoverflow.com/questions/204476/what-should-main-return-in-c-and-c
31st Oct 2019, 1:48 PM
Ipang
+ 2
Thanks
31st Oct 2019, 2:37 PM
Armina
Armina - avatar
0
Please try to search the forum for this question first. There has been so many questions related to return statement. If you have searched and didn't find the previous questions to be of any help, you can edit this question to describe what was missing from the previous discussion about return statement - that didn't answer your question That way we help reducing duplicate questions 👍
31st Oct 2019, 9:45 AM
Ipang
0
I have searched and read about this but didn't find the answer for my question I apperiate if u know the answer help me
31st Oct 2019, 10:12 AM
Armina
Armina - avatar
0
Armina Can you tell me what is your understanding about the return statement so far? and also tell me which part of what you found on search that is troubling you or didn't answer your question?
31st Oct 2019, 11:10 AM
Ipang
0
I searched return 0 which is return value and it means success( if im right )I have trouble understanding what if it has error , in that cause it returns to what and also does the value mean the output of a program?
31st Oct 2019, 12:43 PM
Armina
Armina - avatar