बिजनेस मार्केटिंग का लो कॉस्ट फंडा , अपने मोबाइल से ऑटो sms भेजकर मार्केटिंग करे विजिट करे http://autotextsms.com/ बिजनेस मार्केटिंग का लो कॉस्ट फंडा http://autotextsms.com/

Search This Blog

Translate

What is mean by Type Casting in c programming



What is mean by Type Casting in c

Typecasting involves converting an expression of a given type into another type. In C, you can perform typecasting by placing the data type name in parentheses and placing this in front of the value. For example:

int main()
{
int x;
x = (int)8 / 6;
return 0;
}

In the above example, the usual result of 8/6 should be 1.3333 but since we have typecasted it, the x value would be "1". The later part is simply dropped.
Typecasting is very essential in programming to avoid any unnecessary errors or warnings. Sometimes C compilers need you to define as to what type of typecasting is needed whereas on the other it implicitly converts. The usual notification is "()". Typecasting is like you want to make a variable of one type, such as an int, to act like another type, such as char, for single statement. Although typecast has so many benefits but still it is considered as a headache because it simply truncates your data at important steps

C Program example List