0

c++ what is return statement do???

13th Sep 2016, 5:32 PM
ritik agrawal
ritik agrawal - avatar
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.
13th Sep 2016, 5:42 PM
Zen
Zen - avatar
+ 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.
13th Sep 2016, 6:12 PM
Simant |Kingpin|
Simant |Kingpin| - avatar