There are several ways to return control to the point at which a function was invoked. If the function does not return a result (i.e., it has a void
return type), control returns when the program reaches the function-ending right brace, or by execution of the statement
return;
If the function does return a result, the statement
return expression;
evaluates expression and returns the value of expression to the caller. Some compilers issue errors and others issue warnings if you do not provide an appropriate return
statement in a function that’s supposed to return a result.