+ 1
Why exactly is "return 0" added at the end of every command?
5 Antworten
+ 1
Please try to be specific. Which commands, elaborate your question please
+ 1
I mean at the end of every code
+ 1
Take c++ codes only
+ 1
Return statements are used to exit functions and also to return some results from a function if any
0
First of all, this 'return 0' doesn't exist in all langages. For instance, in Python there is no 'return 0' at the end of the program (even if technically, there is a LOAD_CONST None / RETURN_VALUE at the end).
In langages where this 'return 0' exists, it is used to know if the program ran successfully (0 code) or if there was an error (can be all but 0).