The illustration shows some lines of code numbered from 1 through 25 with the following annotation:
"//Program to demonstrate call-by-reference parameters.
#include <iostream>
void getNumbers(int& input1, int& input2);
//Reads two integers from the keyboard.
void swapValues(int variable1, int variable2);" annotated as "forgot the & here."
"//Interchanges the values of variable1 and variable2.
void showResults(int output1, int output2);
//Shows the values of variable1 and variable2, in that order.
int main( )
{
int firstNum, secondNum;
getNumbers(firstNum, secondNum);
swapValues(firstNum, secondNum);
showResults(firstNum, secondNum);
return 0;
}
void swapValues(int variable1, int variable2)" annotated as "forgot the & here."
"{
int temp;
temp = variable1;
variable1 = variable2;
variable2 = temp;” with the variables annotated as "inadvertent local variable."
“}
<The definitions of getNumbers and
showResults are the same as in Display 5.4.> "