Kahan gye sabhi Ace ho mujhe mere question Ka answer nhi Mila raha??
Explain Implicit Type of Conversion with suitable examples.
Iska to de do
Answers
ᎻᎬᏞᏞᎾ
ᎻᎬᎡᎬ ᏆᏚ YᎾᏌᎡ ᎪNᏚᏔᎬᎡ
When variables and constants of different types are combined in an expression they are converted into the same type. This process of converting one predefined type into another is called type conversion.
Type conversion is of two types:-
Implicit type conversion
Explicit type conversion
Implicit type conversion:
When the type conversion is performed automatically by the compiler without the programmer’s intervention, the type conversion is referred to as implicit type conversion. The compiler basically promotes all operands to the data type of the largest operand.
The rule followed in case of implicit type conversion is illustrated by the image below:
NOTE: The above rule corresponds to C type conversion
Explicit type conversion :
The type conversion which is enforced by the programmer is called explicit type conversion. Basically, the programmer forces an expression to be of a specific type. Explict type conversion is also called type casting.
The general format of explicit type conversion is as follows:
(data_type)(expression);
Here, data_type is any valid c data type .
e.g. x= (float)a+ b;
The above statement causes the result of the operation ‘a+ b’ to be converted to floating-point type and the result is stored in x
ᎻᎾᏢᎬ ᏆᎢ'Ꮪ ᎻᎬᏞᏢ FᎾᎡ YᎾᏌ
In computer science, type conversion or typecasting refers to changing an entity of one datatype into another. There are two types of conversion: implicit and explicit. The term for implicit type conversion is coercion. Explicit type conversion in some specific way is known as casting.