+ 1

Why should we add return in the function? It is running perfectly without it.

18th Feb 2017, 6:05 PM
priya bihani
priya bihani - avatar
3 odpowiedzi
+ 1
we can use various return values (say non zero) to indicate various error condition like parameter out of range, overflow ,underflow in calculations etc , which helps us understand what's going on inside funtion
19th Feb 2017, 3:04 AM
Jayesh Sarvaiya
Jayesh Sarvaiya - avatar
0
That's right.Sometimes the program don't need return 0; and if you don't use that, the compiler automatically adds a return 0; But the return value is useful to check the status when the application exit.return 0 means no error.
18th Feb 2017, 9:15 PM
memol
0
return 0 is basically used for returning 0 value for a int main function. One can always use void in order to neglect return 0
1st Mar 2017, 4:08 PM
Neha
Neha - avatar