C++ Language/Indirection/ReferenceVariables

From Wikibooks, open books for an open world
Jump to navigation Jump to search

A reference (int& riVar = iVar;) must always be initialized to some kind of existing storage, and the location of that storage cannot be changed. However, the value stored at that location can be changed, so subsequently doing riVar = 99; will cause iVar to now contain 99.

Additional information about reference variables (includes interactive examples)