Electrical and Computer Engineering
42 of 48
UAH
CPE 112
Mixed Type Expression Evaluation
•Whenever an integer value and a floating-point value are joined by an operator, implicit type coercion occurs as follows.
1.The integer value is temporarily coerced to a floating-point value.
2.The operation is performed.
3.The result is a floating-point value.
•Consider int sum; int count; float average;
• and average = sum / count;
•average will have the value 0.0
•if sum = 60 and count = 80