mixed mode expressions and implicit type


Mixed Mode Expressions and Implicit type Conversions

A mixed mode expression is one in which the operands are not of the similar type. In this case, the operands are converted before evaluation, to maintain compatibility of the data types.

e.g.

char ch = 'A';

                                ch = ch + 32;

Here, ch will be converted to an integer, since there is an integer(32) in the expression. The result will be an integer.

e.g.

                float f = 10.0;

                int i = 0;

                                i = f / 3;

In this expression, the constant 3 will be changed to a float and then floating point division will take place, resulting in 3.33333, but since the lvalue is an integer the value will be automatically truncated to 3 and the fraction part is lost. (implicit conversion from float to int ).

 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: mixed mode expressions and implicit type
Reference No:- TGS0309255

Expected delivery within 24 Hours