1/24/00
COM1100 Winter2000 Lecture 7
19
Method 2 – pass by reference
nQuestion: write a function that increments an integer.
nMethod 2 : the user supplies a name of the variable whose value should be incremented. The function code will be able to read the value of this variable and change it. We say that the argument is passed by reference and indicate this in the signature by following the data type with an &.
n