ProgrammingVery hard

printf("%d", (int)(0.1 + 0.2 == 0.3)); What is printed in IEEE double arithmetic?

  1. A. 1
  2. B. 2
  3. C. 0
  4. D. undefined behaviour

Correct answer: C. 0

0.1 + 0.2 is not exactly 0.3 in binary floating point, so the comparison is false and the value is 0.

More C Programming questions

Exams that ask this topic