7. Pointers, Arrays, and References

The sublime and the ridiculous are often so nearly related that it is difficult to class them separately.

– Thomas Paine



void*; nullptr


Array Initializers; String Literals

Pointers into Arrays

Navigating Arrays; Multidimensional Arrays; Passing Arrays

Pointers and const

Pointers and Ownership


Lvalue References; Rvalue References; References to References; Pointers and References


7.1. Introduction

This chapter deals with the basic language mechanisms for referring to memory. Obviously, we can refer to an object by name, but in C++ (most) objects “have identity.” That is, they reside at a specific address in memory, and an object can be accessed ...

Get The C++ Programming Language, 4th Edition 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.