The concept of references is simple, but its implications are profound. In this chapter, you’ll learn about references and how they can help you write more efficient game code. Specifically, you’ll learn to:
Access and change referenced values
Pass references to functions to alter argument values or for efficiency
Return references from a function for efficiency or to alter values
A reference provides another name for a variable. Whatever you do to a reference is done to the variable to which it refers. You can think of a reference as a nickname for a variable—another name that the variable goes by. In the first program in this chapter, I’ll show you how to create references. Then, ...