ProgrammingHardTCS NQT · Infosys

unsigned char a = 255; printf("%d", a == -1); What is printed?

  1. A. 0
  2. B. 1
  3. C. compile error
  4. D. undefined

Correct answer: A. 0

a is promoted to int with the value 255, which does not equal -1. The unsigned char never becomes -1.

More C Programming questions

Exams that ask this topic