|
|
 |
|
|
|
|
indicate whether each of the following actual parameters would be valid using pass-by-value, pass-by-reference, or both. |
|
|
|
 |
|
|
|
|
a. letter |
|
|
|
 |
|
|
|
|
b. ANGLE |
|
|
|
 |
|
|
|
|
c. number |
|
|
|
 |
|
|
|
|
d. number + 3 |
|
|
|
 |
|
|
|
|
e. 23 |
|
|
|
 |
|
|
|
|
f. ANGLE * number |
|
|
|
 |
|
|
|
|
g. abs(number) |
|
|
|
|
|
|
|
|
8. A variable named widgets is stored in memory location 13571. When the statements |
|
|
|
 |
|
|
|
|
widgets = 23;
Drop(widgets); |
|
|
|
 |
|
|
|
|
are executed, what information is passed to the formal parameter in function Drop? (Assume the formal parameter is a reference parameter.) |
|
|
|
|
|
|
|
|
9. Assume that, in Exercise 8, the formal parameter for function Drop is named clunkers. After the function body performs the assignment |
|
|
|
 |
|
|
|
|
clunkers = 77; |
|
|
|
 |
|
|
|
|
what is the value in widgets? in clunkers? |
|
|
|
|
|
|
|
|
10. Using the data values |
|
|
|
 |
|
|
|
|
3 2 4 |
|
|
|
 |
|
|
|
|
show what is printed by the following program. |
|
|
|
 |
|
|
|
|
#include <iostream.h>
void Test( int&, int&, int& );
int main()
{
int a;
int b;
int c;
Test(a, b, c);
b = b + 10;
cout << The answers are << b << << c << << a;
return 0;
}
void Test( int& z,
int& x,
int& a )
{
|
|
|
|
|
|