/* 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<5; i++) { printf("ptr: %u points to %d\n", ptr, *ptr); /* skip every other array element */ ptr = ptr + 2; } }