what is meant by Type casting?

Explain your own answer with proper example?

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

Type Casting  --  It is a method/process which is used to change one data type into another data type. It is also known as Type conversion. It is of two types -
1. Implicit  - The conversion of data type automatically by the compiler is called Implicit
type casting. 
ex -       int x = 10  , 
            char y = 'a'  ,  
             x = x + y  ( here y is implicitly converted into int type)            

2.Explicit - The conversion of data type by the user or forced conversion of data type is called Explicit type casting.
ex -             double x = 1.4 ,   
                   int sum = (int)x + 2   ( here x is explicitly converted from double to int )     

C Language

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