ProgrammingHard

printf("%d", (unsigned char)~0x0F); What is printed?

  1. A. 15
  2. B. 240
  3. C. 16
  4. D. 255

Correct answer: B. 240

~0x0F in int is 0xFFFFFFF0, and converting to unsigned char keeps the low byte, 0xF0 = 240.

More C Programming questions

Exams that ask this topic