Home Segments Index Top Previous Next

307: Mainline

Note that allocating space for a pointer variable does not allocate space for the corresponding object. To set up an integer pointer and a corresponding integer object, you need two space-allocating statements and one assignment statement:

int i;          /* Allocate space for an integer, i */ 
int *iptr;      /* Allocate space for a pointer to an integer, iptr */ 
iptr = &i;      /* Assign iptr to the address of i */