In C++, a reference variable is an alias for another object. It is created using the
& sign. Two things to note:
In C++, pass-by-reference refers to passing parameters to a function by using references.
It allows the ability to:
In C++, pass-by-reference with
const can be used for a function where the parameter(s) won’t change inside the function.
This saves the computational cost of making a copy of the argument.
In C++, the memory address is the location in the memory of an object. It can be accessed with the “address of” operator,
Given a variable
porcupine_count, the memory address can be retrieved by printing out
&porcupine_count. It will return something like:
In C++, a pointer variable stores the memory address of something else. It is created using the