ProgrammingVery hardTCS NQT · Infosys

What is printed? Assume unsigned int is 32 bits.

What is printed? Assume unsigned int is 32 bits.
#include <stdio.h>
int main(void) {
    printf("%u", 1 ? -1 : 0u);
}
  1. A. 4294967295
  2. B. 2
  3. C. 0
  4. D. 1

Correct answer: A. 4294967295

The second and third operands have the usual arithmetic conversions applied, so -1 becomes the unsigned value 4294967295.

More C Programming questions

Exams that ask this topic