When Implicit Conversions Occur

The compiler automatically converts operands in the following circumstances:

• In most expressions, values of integral types smaller than int are first promoted to an appropriate larger integral type.

• In conditions, nonbool expressions are converted to bool.

• In initializations, the initializer is converted to the type of the variable; in assignments, the right-hand operand is converted to the type of the left-hand.

• In arithmetic and relational expressions with operands of mixed types, the types are converted to a common type.

• As we’ll see in Chapter 6, conversions also happen during function calls.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset