What does return 0 means .... return is used for what ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What does return 0 means .... return is used for what ??

plez help !

15th Nov 2016, 12:56 PM
snehashish
7 Answers
+ 3
In your main function, return 0 will end your program prematurely.
15th Nov 2016, 1:09 PM
Keto Z
Keto Z - avatar
+ 3
When you purchase something, you get a receipt acknowledging the deal. In the same manner, every function returns something or the other(usually)to the main function (or the function in which it is called). It is like a proof to the calling function that the caked function was executed properly.
15th Nov 2016, 1:16 PM
Mystery
Mystery - avatar
+ 2
every functions unless it is void has to return something so we tell the program which variable to return and function itself acts as the returned value. this applies for main function too so we return anything commonly 0 we can make it void too.
15th Nov 2016, 3:08 PM
Sandeep Chatterjee
+ 2
return 0 returns 0 and return sum returnes the value of sum
15th Nov 2016, 6:36 PM
Sandeep Chatterjee
+ 1
so what is the difference between 'return 0' and 'return sum' (assuming 'sum' is a variable name)
15th Nov 2016, 4:46 PM
Cody Arthur
Cody Arthur - avatar
0
*called
15th Nov 2016, 1:17 PM
Mystery
Mystery - avatar
0
it means ur function have some value which is return by return and it is used for int...
17th Nov 2016, 4:22 AM
Arun Vishwakarma
Arun Vishwakarma - avatar