Electrical and Computer Engineering
40 of 48
UAH
CPE 112
Type Coercion
(Implicit Conversion)
•Integer values and floating-point values are stored differently inside a computer’s memory.
•Consider the declarations:
–int someInt;
–float someFloat;
•and the assignments:
–someFloat = 12;
–someInt = 4.8;
•What actually occurs is
–someFloat = 12.0
–someInt = 4