C Language / Type Conversion

Converting / Changing one data type to other is called as Type Conversion. It is of 2 Types. They were

1. Implicit Type Conversion / type promotion.
2. Explicit Type Conversion / type casting.

Implicit Type Conversion
It is performed automatically by the compiler which converts all operands into the data type of the largest operand without programmer’s intervention

Boarding Conversion of small data type to Long Data Type and Data Preserved Here
Narrowing Conversion of Long data type to small Data Type and Data Truncated / Rounded off here.

Explicit Type Conversion
It is performed by the programmer using the programming instructions.

Explicit Type Conversion Syntax Example
(data_type)expression; C=(int)a+b*d;


Home     Back