+ 1
Why should we add return in the function? It is running perfectly without it.
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
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.
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