Implicit conversions in c++
we can mix the data types in expression. for example n=6+3.9;
is valid statement. whenever data types are mixed in an expression, c++ programming performs the conversions automatically. this process is know as automatic conversion or implicit .
when the compiler encounters an expression, it divides the expressions into the sum expressions consisting of one operator and one or two operands. for binary operator, if the operands type differ, the compiler converts one of them to match with the other, using the rule that the “smaller” type is converted to the “wider” type , for example if one of the operand is an int and the other is a float, the int is converted into float because a float is wider than an int. the water fall model shown in fig
whenever a clear or short int appears in an expression , it is converted to an int, this is called integral widening conversion.
The implicit conversion is applied only after complete all integral widening conversion.
Type of result of mixed-mode arithmetic operations are in table