ProgrammingHard

struct Bits { int f : 4; }; struct Bits b; b.f = 3; printf("%d", b.f); What is printed in C for a signed 4-bit field holding 3?

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

Correct answer: A. 3

3 fits in a 4-bit signed field, which holds values from -8 to 7, so it prints 3.

More C Programming questions

Exams that ask this topic