ProgrammingVery hard

struct Pack { char a; int b; } p = {'x', 5}; unsigned char *raw = (unsigned char *)&p; printf("%d", raw[0] == 'x'); What is printed?

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

Correct answer: D. 1

The first byte of the struct is its char member, which holds 'x'. Comparing gives 1.

More C Programming questions

Exams that ask this topic