course.wilkes.edu/CS125Labs
Welcome to the site for CS 125 labs!

 

Experiment 5: Reference Parameters

The Question: If a function alters the value of one of its reference parameters, what affect will that have on the corresponding argument?

Hypothesis: Review the reference parameter definition, and then construct a hypothesis.



The Experiment: We can test your hypothesis by making two of the parameters in Change() a reference parameter. Such a change must be made in both the prototype:

   void Change(int & param1, int & param2, int param3);
and in the definition:
   void Change(int & param1, int & param2, int param3)
   {
       param1 = 1;
       param2 = 2;
       param3 = 3;
   }

Observation: Translate and execute your program. What is displayed ?



Conclusions: Review the definitions of value and reference parameters, and explain what happened. What determines the parameter with which an argument is associated?







 
  Home

Help

Lab 0

Lab 1

Lab 2

Lab 3a

Lab 3b

Lab 4

Lab 5

Lab 6

Lab 7

Lab 8

Lab 9

Lab 10

Lab 11

Lab 12

Lab 13



Membership

Login




Last update: Wednesday, August 23, 2000 at 3:15:26 PM.
visitors to this page.