|
| |
Mixing types:
- suppose: x and y are float
operations are performed one at a
time, according to priority;
- x+3*(y-1) ... () * +
- if operands have different types, one
of them is converted (if possible);
- 1 is converted to float to be
subtracted from y;
- 3 is converted to float so that it
can be multiplied by (y-1);
- result of each operation has same
type as operands
- conversion goes from int, long int,
float, double, long double;
- conversion may drop decimal part or
significant digits;
Conversion in assignments:
- int k;
- k=2.9;
- will result in k receiving the value
2.
|