// Mr. Minich
// Computer Science Using C++
// Ch. 9 Demo Program #6
// January 30, 2000
// Purpose - to illustrate the difference between passing by value and passing by reference.
#include <iostream.h>
void permanentChange(int & aValue); // demonstrates passing by reference
void nonPermanentChange(int aValue); // demonstrates passing by value
int main()
{
int original = 10; // used to demonstrate difference between passing by value and
// passing by reference
nonPermanentChange(original); // Notice that you cannot tell from the call statement
cout << original << endl; // if the argument is being passed by value or by
// reference
permanentChange(original);
cout << original << endl;
return 0;
}// end of main
void permanentChange(int & incoming)
{
incoming = 300;
}// end of permanentChange
void nonPermanentChange(int incoming)
{
incoming = 8000000;
}// end of nonPermanentChange