/* PASSING BY VALUE In this form of passing, the value is passed on to the next function, but the variable is not. If any changes occur to the value once it has been passed, the changes will not affect the original variable. The receiving function looks at this value as if it were a local value. PASSING BY ADDRESS Passing by address means that the entire variable is moved from one function to the next. An address is a variable's location in memory. Address passing is most useful when passing an array. The address held by the array will also move. PASSING BY REFERENCE This form of value passing is designed to pass non-arrays. Reference passing works the same as address passing except reference passing doesn't work with arrays. */ #include void main () { void getvalue_fcn (int) ; void getadd_fcn (char name [10]) ; void getref_fcn (int &age) ; int height ; char name [10] ; int age ; cout << "How tall are you in inches? " ; cin >> height ; getvalue_fcn (height) ; cout << "What is your first name? " ; cin >> name ; getadd_fcn (name) ; cout << "In six years you will change your name to " << name << endl ; cout << endl << "How old are you? " ; cin >> age ; getref_fcn (age) ; cout << "In six years you will be " << age << " years old." << endl ; } // end of main // ***************************************************************************** void getvalue_fcn (int height) { height += 3 ; cout << "If you grow a half an inch a year, you will be " << height << " inches in six years." << endl << endl ; } // end of getvalue function // ***************************************************************************** void getadd_fcn (char name [10]) { name [3] = 'e' ; name [4] = 'r' ; name [5] = '\0' ; return ; } // end of getadd function // ***************************************************************************** void getref_fcn (int &age) { age += 6 ; return ; } // end of getref function