ProgrammingHardTCS NQT · Infosys

int x = 10; int *px = &x; *px += *px * 2; What is x?

  1. A. 20
  2. B. 30
  3. C. 40
  4. D. 12

Correct answer: B. 30

*px * 2 is 20, and adding that to *px gives 30. The pointer and the variable name refer to the same object.

More C Programming questions

Exams that ask this topic