0
c++ what is return statement do???
2 Answers
+ 2
It's only used when launching your program with another program. A return value of 0 means no error, while a non-zero value means some kind of error (the meaning is up to you). The returned value can be used in the main program to act differently.
+ 2
A called function uses return statement to return a value to the calling function and hence defining the return type of a function.
In case of main function, it is a standard to return 0 to signify successful execution.