ProgrammingHardGATE CS · Campus placements

uint32_t value = (uint32_t)-1; printf("%d", value == 0xFFFFFFFFu); What is printed?

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

Correct answer: A. 1

-1 converted to uint32_t is 2^32 - 1, which equals 0xFFFFFFFF. The comparison is true and prints 1.

More C Programming questions

Exams that ask this topic