/* * pointerarray.c * Purpose: This shows we can access element of the array in 2 ways. * The fist does not move the pointer * The second increments the pointer */ #include #define POSITION(x) printf(" // Pointer ppp is at %p \n", x) int main(void) { int prime[]={2,3,5}; int *pp; pp= prime; //Address check 1: access only printf("%d %p", *pp, pp); POSITION(pp); //Address check 1: access only printf("%d %p", *(pp+1), (pp+1)); POSITION(pp); //Address check 1: access only printf("%d %p", *(pp+2), (pp+2)); POSITION(pp); // Address check 2: increment and access printf("\n%d %p", *pp, pp); POSITION(pp); pp++; printf("%d %p", *pp, pp); POSITION(pp); pp++; printf("%d %p", *pp, pp); POSITION(pp); return 0; }