+ 1

What is "return 0"

Why do we always return 0 at the end of a program while the program is expected to return something So what is this "return 0"

10th Jan 2018, 7:41 PM
lelwyn vaz
lelwyn vaz - avatar
3 Answers
+ 2
return is a command used to return any value at the end of a function. return 0 is mostly used in c++ to return null value in the main function. It is used only if the function defined is not already a void function like ' void main() ' when void is mention it is implied that return value is 0 and 'return 0 ' doesn't have to be specified
10th Jan 2018, 8:02 PM
Barathan Ganesh
Barathan Ganesh - avatar
+ 1
Thanks @barathan and @jamie for helping me understand
11th Jan 2018, 3:02 AM
lelwyn vaz
lelwyn vaz - avatar