- Value parameters use "pass by value"; pass by value makes a copy of the original parameters before passing them to the function
- Changes made to value parameters within the function are discarded when the function returns; modifications were made to copies of the originals
- Reference parameters use "pass by reference"; aliases of the original parameters are passed to the function
- Alias—The location (memory address) of the actual parameter, not its value
- Changes made to reference parameters modify the original variables that were passed in, not copies
- Parameters are value parameters by default; precede the variable name with an ampersand (&) to make it a reference parameter
Syntax:
void someFunction1(int value); // value
void someFunction2(int &value); // reference