Answer E2

Expression evaluates to: 0

The expression 45.0 is of type double. The printf format code %d is for integer.

  printf("Expression evaluates to: %d\n", 45.0 );

The 64 bits that encode the 45.0 are not interpretted correctly at run time and produce character '0' on my computer. (Your computer may produce a different incorrect result.)

Notice that the "point zero" in 45.0 makes the expression a double. Sometimes people think that it is an integer because there is no fractional part, but it is the data type and not the value that matters.

Recall that ANSI C does not specify the number of bits for each data type. Doubles are usually 64 bits, but this depends on your system.



Back to Puzzle Home