Issue: If a function alters the value of one of its value parameters, what is the effect on the argument corresponding to that parameter?
Hypothesis: When a value parameter is changed, the corresponding argument is also changed in the same way.
The Experiment:
The current version of main()
in params.cpp
implements the following algorithm:
arg1
, arg2
, and
arg3
.arg1
, arg2
, and
arg3
.change()
, passing it arg1
, arg2
,
and arg3
.arg1
, arg2
, and
arg3
.change()
tries to alter the values of its
parameters. Does that affect the variables declared in the main
program?
By comparing the values displayed before the function call with those displayed after the function call, we can see whether changes within a function make any difference outside the function.
Observation:
Question #8.2.1: Compile and execute your program. What does it output?
Conclusions:
Question #8.2.2: Is our hypothesis correct? If not, what should it be?
Question #8.2.3: Review the definition of a value parameter at the beginning of Part I of this lab exercise. What key word(s) in this definition give a clue about what the outcome of this experiment would be?