Electrical and Computer Engineering
10 of 30
UAH
CPE 112
Matching Arguments
with Parameters
•Only a variable can be passed as an argument to a reference parameter because a function can assign a new value to the argument.
•In contrast, an arbitrarily complicated expression can be passed to a value parameter.
•Consider the following function heading:
• void DoThis (float val,    //Value
•          int& count)   //Reference
•Then, the following function calls are valid
–DoThis(someFloat, someInt)
–DoThis(9.83, intCounter)
–DoThis(4.9 * sqrt(y), myInt);