Function of type conversion. Standard conversion rules of C++.

Q3. What is the function of type conversion? Write the standard conversion rules of C++.

Ans. The process of converting one predefined type into another is called Type Conversion.

C++ facilitates the type conversion in two forms:

  • Implicit Type Conversion

An implicit type conversion is a conversion performed by the compiler without programmer’s intervention.

  • Explicit Type Conversion

The explicit type conversion is user-defined that forces an expression to be specific type.

Standard Conversion Rules in C++

Step No. If either’s type is Then result type of other operand Otherwise
1. long double long double step 2
2. double Double step 3
3. float Float step 4
4. Integral promotion takes place followed by step 5.
5. unsigned long unsigned long step 6
6. long int and the other is unsigned int
  1. long int (provided long int can represent all values of unsigned int).
  2. unsigned long int (if all values of unsigned int can’t be represented by long int)
step 7


step 7

7. long Long step 8
8. unsigned Unsigned both operands are int.


Once these conversion rules have been applied, each pair of operands is of the same type and the result of each operation is the same as the type of both operands.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: