Data type conversion
An operator must have
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
- Otherwise, if either operand is double the other is converted
- Otherwise, if either operand is float the other is converted
- Otherwise, convert char and short to int
- Then, if an operand is long convert the other to long.
cast to force a type conversion.