November 2002
Beginner to intermediate
142 pages
4h 19m
English
Operands of the types _Bool,
char, unsigned char,
short, and unsigned short, as
well as bit-fields, can be used in expressions wherever operands of
type int or unsigned int are
permissible. In such cases, integer
promotion
is performed on the operands: they are
automatically converted to int or
unsigned int. Such operands are converted to
unsigned int only if the type
int cannot represent all values of the original
type.
Thus C always “expects” values that
have at least type int. If c is
a variable of type char, then its value in the
expression:
c + '0'
is promoted to int before the addition takes place.
Read now
Unlock full access