ProgrammingHardGATE CS · Campus placements

What does printf("%d", sizeof('a') == sizeof(int)) print?

  1. A. 1
  2. B. 0
  3. C. depends on the platform
  4. D. 1 only on 8-bit char systems

Correct answer: A. 1

Character constants have type int in C, so sizeof('a') equals sizeof(int) on every conforming platform, and the comparison prints 1.

More C Programming questions

Exams that ask this topic