+ 1

Why exactly is "return 0" added at the end of every command?

13th Oct 2020, 5:03 AM
Bharadwaaja Kanakadandi
Bharadwaaja Kanakadandi - avatar
5 Antworten
+ 1
Please try to be specific. Which commands, elaborate your question please
13th Oct 2020, 5:04 AM
Kirabo Ibrahim
Kirabo Ibrahim - avatar
+ 1
I mean at the end of every code
13th Oct 2020, 5:06 AM
Bharadwaaja Kanakadandi
Bharadwaaja Kanakadandi - avatar
+ 1
Take c++ codes only
13th Oct 2020, 5:48 AM
Bharadwaaja Kanakadandi
Bharadwaaja Kanakadandi - avatar
+ 1
Return statements are used to exit functions and also to return some results from a function if any
13th Oct 2020, 8:50 AM
Kirabo Ibrahim
Kirabo Ibrahim - avatar
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).
13th Oct 2020, 5:47 AM
Théophile
Théophile - avatar