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 is also changed in the same way.
The Experiment:
The current definition of main()
follows this 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 if the function's changes make any difference outside the function.
Observation:
Question #8.2.1: Compile and execute your program. What does it print?
Conclusions:
Question #8.2.2: Is our hypothesis correct? How do you know? If it's not correct, what should it be?
Question #8.2.3: How might the definition of a value parameter given you a clue about this experiment?