Initializing a Pointer
int i;
int *p = &i;
The declarations allocate storage for two cells, int i and pointer to int p. It also initializes p to have the address of i.
Variable i must be declared before p in order to use it in the expression &i.
Previous slide
Next slide
Back to first slide
View graphic version