Chapter 18

Taking a Second Look at C++ Pointers

In This Chapter

arrow Defining operations on a pointer

arrow Comparing pointer addition with indexing an array

arrow Extending arithmetic to different types of pointers

arrow Sorting out constant pointers from pointers to constants

arrow Reading the arguments to a program

Chapter 17 introduces the concept of a pointer variable as a variable designed to contain the address of another variable, and even suggests a couple of uses for pointer variables. However, you’ve only begun to see the myriad ways that pointer variables can be used to do some pretty cool stuff — and really confuse you at times as well.

This chapter examines carefully the relationship between pointers and arrays, a topic that I brush over in the previous chapter.

Pointers and Arrays

Some of the same operators applicable to integers are applicable to pointer types. This section examines the implications of this to pointers and to the array types studied so far.

Operations on pointers

Table 18-1

Get Beginning Programming with C++ For Dummies, 2nd 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.