ProgrammingHardTCS NQT · Infosys

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

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

Correct answer: A. 240

~c is an int with low byte 0xF0, and the cast to unsigned char keeps 0xF0, which is 240.

More C Programming questions

Exams that ask this topic