Loading, please wait...

Implicit Conversion

Implicit conversions don’t need an operator for converted. They have performed themselves by the compiler when a value is copied to a compatible type in the program. When the value of the variable has been promoted from int to double and we’ve not had to specify any type-casting operator. Then it is known as a standard conversion.

 

Example:

/*A C program to show implicit conversion */
#include<stdio.h>
int main( void )
{
int i = 20;
double d;

d = i; // implicit conversion

printf(“Implicit value is %d”, d);

getch();
}

 

Output:

Implicit value is 20.

 

 

Usual Arithmetic Conversion

These are implicitly performed by the compiler to cast their values in a common type, C uses the rule that, in all kind of expressions except assignments, any implicit type conversions made from a lower size to a higher size type as shown in the following order.

 

bool->short/char -> int -> unsigned int -> long -> unsigned long -> long long -> unsigned long long -> float -> double -> long double