|
course.wilkes.edu/CS125Labs |
||||
Experiment 3: Naming Parameters and Arguments
The Question: If a value parameter has the same name as its corresponding argument, will altering it alter the corresponding argument?
Hypothesis: Review the value parameter definition, and then construct a hypothesis.
void Change(int arg1, int arg2, int arg3)
{
arg1 = 1;
arg2 = 2;
arg3 = 3;
}
(Hint: To make it easier to undo this modification,
use copy-and-paste to make a copy of the function with the original names;
surround one of the copies with a block comment, and modify the uncommented function.)
This function is called in the main program with the statement:
Change(arg1, arg2, arg3);so that if giving parameters the same names as their arguments is a problem, compiling params.cpp will produce errors.
Observation: Translate your source program. What is displayed ?
Undo your modifications and then continue.
|
Home Membership
|
|||
|
Last update: Wednesday, August 23, 2000 at 3:10:03 PM. |
||||