/* a pointer to an array, and pointer arithmetic */ #include int main() { int i; int a[10]; int *ptr; /* give each element a value */ for (i=0; i<10; i++) a[i] = i + 100; /* point the pointer at the first array element */ ptr = a; /* use the pointer and pointer arithmetic to prin the array */ for (i=0; i<10; i++) { printf("ptr: %u points to %d ", ptr, *ptr); printf(" array element a[%d] is %d\n", i, a[i]); ptr++; } }