Expression evaluates to: 12.000000
This answer might surprise you. Here is the statement:
printf("Expression evaluates to: %f\n", 10.0 + 5/2 ); /* division is done first */
5/2 is done first.5/2 produces integer 2int 2 is promoted to double 2.0double
It is a mistake to think that the 10.0 makes the entire expression floating point.
Expressions are evaluated subexpression by subexpression.
If both operands of a subexpression are int, then the operation and value of
the subexpression are int.
If the next operation included a double the subexpression then is promoted to a double.