ProgrammingVery hard

With int a[3][4] (4-byte int) and int (*p)[4] = a, what is (char *)(p + 2) - (char *)p?

  1. A. 8
  2. B. 16
  3. C. 32
  4. D. 24

Correct answer: C. 32

p + 2 advances two whole rows, each of 4 ints of 4 bytes, so 2 x 16 = 32 bytes. The pointer step counts whole rows, not single ints.

More C Programming questions

Exams that ask this topic