So, what happens when expressions are performed with operands of different types, for example, the multiplication of an intwith a float, or the subtraction of a double from a short?
To answer that, let's revisit our sizes_ranges2.c program from Chapter 3, Working with Basic Data Types. There, we saw how different data types took different numbers of bytes; some are 1 byte, some are 2 bytes, some are 4 bytes, and most values are 8 bytes.
When C encounters an expression of mixed types, it first performs an implicit conversion of the smallest data type (in bytes) to match the number of bytes in the largest data type size (in bytes). The conversion occurs such that the value with the narrow range would be converted into the other with a wider range of values.
Consider the following calculation:
int feet = 11;
double yards = 0.0;
yards = feet / 3;
In this calculation, both the feetvariable...