How Pointers Are Stored

Figure 8.1 also shows that while a pointer is a special kind of variable, it is not a mysterious entity floating in limbo. A pointer is a true variable whose contents are stored at a specific memory address.

In POINTER.C we don't care precisely where the pointer's contents are stored—the compiler handles that detail for us, as it does so many others. So Figure 8.1 does not include the address of the storage for ptr. It does show, however, that the pointer is stored in two bytes, the same amount of memory needed to store an int value.

NOTE:

The actual amount of memory needed to store a pointer variable depends on the current “memory model.” In the small memory model—the default for QuickC for Windows version 1.0—a pointer is stored in two bytes. In some larger memory models, a pointer is stored in four bytes. For purposes of discussion, this chapter and the following chapter assume the small memory model.