Data type conversion
An operator must have
operands
of the same
type before it can carry out the operation. Because of this, C will perform
some automatic conversion of data types.
These are the general rules for binary operators (* + / % etc):
- If either operand is long double the other is converted to
long double.
- Otherwise, if either operand is double the other is converted
to double
- Otherwise, if either operand is float the other is converted
to float
- Otherwise, convert char and short to int
- Then, if an operand is long convert the other to long.
See Also
cast to force a type conversion.
typedef keyword.
Martin Leslie