Casting : 1. during casting only the type of data to be change - TopicsExpress



          

Casting : 1. during casting only the type of data to be change but not data itself. eg: int g=20; float f = (int)g; please observe that casting is effect on the type from int to float but the value 20 must constant. 2. there are two type of casting : i) - Primitive casting : the casting between data type. a. Auto widering : the conversion of low data type to high. it is automatically converted by compiler or you can keep it explicitly. example : int i=23; double d=i;// automatically covert from int to double. b. Explicit Narrowing : the conversion of high data type to low. it doesnt automatically. we must keep it explicitly. example : double d=10.32; int i=d;// Error int i=(int) d;// explicit conversion from double to int. Note : priority : byte
Posted on: Fri, 28 Feb 2014 11:35:07 +0000

Trending Topics



Recently Viewed Topics




© 2015