ProgrammingVery hard

unsigned char c = 0xF0; c |= 0x0F; c <<= 1; printf("%d", c); What is printed?

  1. A. 254
  2. B. 510
  3. C. 255
  4. D. 30

Correct answer: A. 254

c becomes 0xFF, then the shift is done in int and stored back into an unsigned char, giving 0x1FE mod 256 = 0xFE = 254.

More C Programming questions

Exams that ask this topic