Lab 8: Experiment 1

Changing Value Parameters

Issue: Is it permissible to alter (e.g., assign a value to) a value parameter?

Hypothesis: It is possible to alter value parameters.

The Experiment: The params.cpp source program is set up as an experiment to test the hypothesis. The function change() starts out with value parameters which are assigned new values.

The compiler controls whether you are allowed to do certain things.

Question #8.1.1: If you're not allowed to change value parameters, what is the compiler likely to do? (Hint: what does the compiler do whenever it hates something you've done.)

Keep in mind that we're only concerned now if the compiler will let us do this. We don't care (yet) what it actual does if we're allowed to.

Observation: Compile your program.

Question #8.1.2: What do you observe when you compile the program?

Conclusions: Review the definition of a value parameter, and record your conclusions.

Question #8.1.3: So? Is our hypothesis correct? How do you know? If it's not correct, what should it be?


Back to the Lab Exercise  |  Forward to the Next Experiment
© 2003 by Prentice Hall. All rights reserved.
Report all errors to Jeremy D. Frens.