+ 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 ?
6 Réponses
+ 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
+ 2
Thanks
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 👍
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
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?
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?