When we write void f(int &x) {...} and call f(y), the reference variable x becomes another name – an alias – for the value of y in memory. We can declare a reference variable locally, as well:
int y;
int &x = y; // Makes x a reference to, or alias of, y
After these declarations, changing x will change y and vice versa, because they are two names for the same thing.
References are just pointers that are dereferenced every time they are used. Just like pointers, you can pass them around, return them, set other references to them, etc. The only differences between using pointers and using references are:
We will talk about this topic later, in classes chapter.