O'Reilly logo

Beginning C++ Through Game Programming, Third Edition by Michael Dawson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. References: Tic-Tac-Toe

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:

  • Create references

  • 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

Using References

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required