Next: Default Parameter Values
Up: Functions
Back: Parameter Values
-
A C++ reference is an alias (or second) name for a variable
-
To declare a reference, you place the ampersand (&) character
immediately after the variable's type and then specify the reference
name
followed by an equal sign and the name of the variable the reference
is to alias
-
Once you assign a value to a reference, you cannot change the
reference value
-
You should include several comments before and within
functions that use references to change parameter's value to ensure
that another programmer who is reading your code can recognize the
change
-
Over using references can lead to program code that is difficult to
understand