Next: Argument Promotions, Previous: Explicit Type Conversion, Up: Type Conversions [Contents][Index]
Certain type conversions occur automatically in assignments and certain other contexts. These are the conversions assignments can do:
void * to any other pointer type
(except pointer-to-function types).
void *.
(except pointer-to-function types).
bool. (The result is
1 if the pointer is not null.)
These type conversions occur automatically in certain contexts, which are:
double i; i = 5;
converts 5 to double.
void foo (double); foo (5);
converts 5 to double.
return statement converts the specified value to the type
that the function is declared to return. For example,
double
foo ()
{
return 5;
}
also converts 5 to double.
In all three contexts, if the conversion is impossible, that constitutes an error.