Reference example
The parameter i gets passed on to the function as a reference, so in the negate() routine the variable j means the same value as the i in main(). We can assign values to the reference and change the variable in main().
If we define the function like the one left, i gets passed on to the function by value, that is, a copy of the variable i is made and given to negate(). We can assign values to the copy, but that will not change the variable in main().
Because passing parameters via a reference is very efficient (no copying of values), the C++ compiler uses this technique in many places (so it’s important to understand the concept).
Couldn’t this be done with a pointer as well? To some extent, yes, but not all. Code using references is more powerful and more elegant.