Chapter 8

Taking a First Look at C++ Pointers

In This Chapter

arrow Addressing variables in memory

arrow Declaring and using pointer variables

arrow Recognizing the inherent dangers of pointers

arrow Passing pointers to functions

arrow Allocating objects off the heap (whatever that is)

So far, the C++ language has been fairly conventional compared with other programming languages. Sure, some computer languages lack (il-)logical operators like those in Chapter 4, and C++ has its own unique symbols for things, but there’s been nothing new in the way of concepts. C++ really separates itself from the crowd in its use of pointer variables. A pointer is a variable that “points at” other variables. I realize that’s a circular argument, but suspend your disbelief at least until you can get into the chapter.

This chapter introduces the pointer variable type. It begins with some concept definitions, flows through pointer syntax, and then introduces some of the reasons for the pointer mania that grips the C++ programming ...

Get C++ For Dummies, 7th 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.