Pointers

Pointers are described in Chapter 8, “Pointers,” and Chapter 9, “Advanced
Pointers.”

A “pointer” is a variable that contains the memory address of an item rather than its value. A pointer can point to any type of data item or to a function. The following code illustrates pointer declarations:

int *intptr; /* Pointer to an integer */

char *name; /* Pointer to char */

The following operators are used with pointers:

The indirection operator (*) has two uses. In a declaration, it means that the declared item is a pointer. In an expression, it denotes the data being pointed to.

The address-of operator (&) yields the memory address at which an item is stored.

You can perform four arithmetic operations on pointers:

Adding a pointer and an integer

Subtracting an integer from a pointer

Subtracting two pointers

Comparing two pointers

Pointer arithmetic operations are automatically scaled by the size of the object pointed to. For instance, adding 1 to a pointer to a float item causes the address stored in the pointer to be incremented four bytes, the size of one float item.

Based-pointer support is a highly advanced feature included in QuickC for Windows for compatibility with Microsoft C version 6.0. Please refer to your C 6.0 documentation for information about based pointers and objects.