Your Ad Here

Thursday, September 18, 2008

Type Conversion in Expressions

When constants and variables of different types are mixed in an expression, they are all converted to
the same type. The compiler converts all operands up to the type of the largest operand, which is
called type promotion. First, all char and short int values are automatically elevated to int. This
process is called integral promotion. (In C99, an integer promotion may also result in a conversion
to unsigned int .)

No comments: