#include int main () { int first[10]; /* an array of 10 integers */ char second[10]; /* an array of 10 characters */ int idx; /* loop index variable */ /* Print array starting addresses. */ printf (" first starts at memory address %p\n", first); printf ("second starts at memory address %p\n\n", second); /* Print header for table. */ printf (" &first[idx] - "); printf ("&second[idx] -\n"); printf ("idx &first[idx] &second[idx] &first[0] "); printf (" &second[0]\n"); /* Print table of array indices. */ for (idx = 0; 10 > idx; idx++) { /* Array indices in C run from 0 to ((length of array) - 1). */ printf ("%2d%17p%17p%10ld%16ld\n", idx, &first[idx], &second[idx], (&first[idx]) - (&first[0]), (&second[idx]) - (&second[0])); } /* C does not check array bounds for you. Calculating addresses * is safe, but using non-existent array entries (not done here) * is not safe. */ printf ("\n&first[-2] = %p\n", &first[-2]); printf ("&first[12] = %p\n", &first[12]); return 0; }