|
|
|
|
|
|
|
In the preceding chapters, we looked at the simple types and structured types available in C++. There are only two built-in data types left to cover: pointer types and reference types (see Figure 17-1). These types are simple data types, yet in Figure 17-1 we list them separately from the other simple types because their purpose is so special. We refer to pointer types and reference types as address types. A variable of one of these types does not contain a data value; it contains the memory address of another variable or structure. Address types have two main purposes: they can make a program more efficienteither in terms of speed or in terms of memory usageand they can be used to build complex data structures. We demonstrate how they make a program more efficient in this chapter. Chapter 18 explains how to build complex structures using address types. |
|
|
|
|
|
|
|
|
In many ways, we've saved the best till last. Pointer types are the most interesting data types of all. Pointers are what their name implies: variables that tell where to find something else; that is, pointers contain the addresses or locations of other variables. |
|
|
|
|
|
|
|
|
Figure 17-1
C++ Data Types |
|
|
|
|
|