This section contains 177 words (approx. 1 page at 300 words per page) |
A value parameter is a variable that is passed to a function when it is called. Value parameters are also called actual parameters. Given the function call:
- pow(i, j);
i and j are both value parameters. The values of i and j at the time this call is made to the pow() function are the values passed into the formal parameters of the function. The formal parameters are the variables used in the definition of the function. Given the function definition:
- int pow(int base, int exp) {...}
base and exp are the formal parameters of the function. The type of any value parameter needs to be the same type as the formal parameter, or a subtype of the formal parameter's type. The order in which value parameters are passed to a function call will correspond to the order in which the formal parameters will be assigned values when the function is evaluated. The function's definition determines its formal parameters. However, every time a function is called, it can have different value parameters.
This section contains 177 words (approx. 1 page at 300 words per page) |