Type Casting (Type Conversation): in C


Type Casting (Type Conversation):
It is the process of converting one data type into another data type. When computing an expression in ‘C’ language encounters a value in the expressing into higher data type value explicitly. We can convert data type of a value explicitly using a method known as casting.
An integer is automatically converted into long int. A float value is automatically converted into long double, but an integer cannot be converted into float directly in the ‘c’ language. We must convert an integer into float value using casting.
Example: int   a= 20;
               float  b;
            b=(float)a/3;   (or)  b = a/3.0;         รจ b=6.666.

Followers