ProgrammingVery hard

struct W { int x; }; struct W w1 = {3}, w2 = {3}; printf("%d", w1.x == w2.x && memcmp(&w1, &w2, sizeof w1) == 0); What is printed (no padding in this struct)?

  1. A. 0
  2. B. 3
  3. C. 1
  4. D. 2

Correct answer: C. 1

Both members hold 3 and the struct has no padding, so memcmp also reports equality. The output is 1.

More C Programming questions

Exams that ask this topic