ProgrammingHardTCS NQT · Infosys

int x = 1, y = 2, z = 3; int *ptrs[3] = {&x, &y, &z}; What is *ptrs[1] + *ptrs[2]?

  1. A. 3
  2. B. 4
  3. C. 5
  4. D. 6

Correct answer: C. 5

ptrs[1] points to y and ptrs[2] points to z, so the sum is 2 + 3 = 5. Arrays of pointers store addresses, not values.

More C Programming questions

Exams that ask this topic