Conversões de tipos em C

Do livro Kernighan & Ritchie, 1978:

Implicit arithmetic conversions work much as expected. In general, if an operator like + or * which takes two operands (a "binary operator") has operands of different types, the "lower" type is promoted to the higher type. More precisely, for each arithmetic operator, the following sequence of conversion rule is applied.

char and short are converted to int, and float is converted to double.

Then if either operand is double, the other is converted to double, and the result is double.

Otherwise if either operand is long, the other is converted to long, and the result is long.

Otherwise if either operand is unsigned, the other is converted to unsigned, and the result is unsigned.

Otherwise, the operands must be int, and the result is int.

Notice that all float's in an expression are converted to double; all floating point arithmetic in C is done in double precision.

Conversions take place across assignments; the value of the right side is converted to the type of the left, which is the type of the result. A character is converted to an integer, either by sign extension or not, as described above. The reverse operation, int to char, is well-behaved - excess high-order bits are simply discarded. Thus in

   int i;
   char c;

   i=c;
   c=i;
the value of c is unchanged. This is true whether or not sign extension is involved.

If x is float and i is int, then

   x=i
and
   i=x
both cause conversion; float to int causes truncation of any fractional part.
double is converted to float by rounding. Longer int's are converted to shorter ones or to char's by dropping the excess high-order bits.

Since a function argument is an expression, type conversions also take place when arguments are passed to functions: in particular, char and short become int, and float becomes double. This is why we have declared functions arguments to be int and double even when the funcon is called with char and float.