TYPE CASTING

It is user defined data type conversion. It is done with the Help of Casting operator ( ). Its is also called Explicit Type Conversion .

Example :- The 22/7 will give integer value so it is forced to convert into flat type before assigning to variable
                  Pi

Float Pi ;
pi=(float )22/7

AUTOMATIC TYPE CASTING

It is a data conversion preformed by compiler on its own. It occur whenever an expression has different data types .Smaller data type are converted to larger data types to avoid data loss.

Example :- a,b,c are of int type and x and y are of float type . Then in the expression x/a, a will be automatically changer into float type

int a=7,b=2,c ;
float x=12.5,y ;
y=x/a ; 
Designed By Blogger Templates | Templatelib & Distributed By Blogspot Templates