CHAPTER 6

image

Pointers and References

The concepts of pointers and references have similarities, which is why I have put them together in a single chapter. Pointers are important because they provide the foundation for allocating memory dynamically. Pointers can also make your programs more effective and efficient in other ways. Both references and pointers are fundamental to object oriented programming.

In this chapter you’ll learn

  • What pointers are and how they are defined
  • How to obtain the address of a variable
  • How to create memory for new variables while your program is executing
  • How to release memory that you’ve allocated dynamically
  • The difference ...

Get Beginning C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.