what is meant by Type casting?

Explain your own answer with proper example?

  • Rahul
  • 12 Jul
  • 14188 Views
  • 42 Answers
Your Answer

type casting is converting one datatype into another data type. There are teo types of type casting.
1) implicit typecasting
It is done automatocally by the compliter .Programmer doesnt worry about it. when the existing datatype size is less that than the desired datatype,then this typecasting is done. eg if int datatype  variable want to change into float. int takes 2 bytes and float takes 4 bytes. So 4 < 2.and it is done implicitly
2) Explicit 
eg let float datatype variable wants to change into int.
 float a;
int b;
b=int(a)//i want to assign value of a to b.

C Language

Didn't get the answer.
Contact people of Talent-C Language directly by clicking here