|
|
|
|
|
|
|
Figure 8-3
Returning a Function Value to the Expression That Called the Function |
|
|
|
 |
|
 |
|
|
Function Value Type The data type of the result value returned by a function. |
|
|
|
|
|
|
|
|
The last statement in the Day function evaluates the expression |
|
|
|
|
|
|
|
|
(month - 1) * 30 + correction + dayOfMonth |
|
|
|
|
|
|
|
|
and returns the result as the function value (see Figure 8-3). |
|
|
|
|
|
|
|
|
You now have seen two forms of the return statement. The form |
|
|
|
|
|
|
|
|
is valid only in void functions. It causes control to exit the function immediately and return to the caller. The second form is |
|
|
|
|
|
|
|
|
This form is valid only in a value-returning function. It returns control to the caller, sending back the value of Expression as the function value. (If the |
|
|
|
|
|