Explicit Casting :
This type of casting done by force not by the compiler. If the
operands are of diffrent types,the Higher type is converted to the lower
type before the operation proceds by force.
for example :- if we do like this:
Output willbe 2.000000 which is Incorrect.
now we go with Explicitly casting
c=(float)a/b; // Explicitly here a temporarly converted or casted to float
Output willbe 2.666667 which is Correct.
When to use :
1) Type casting is used when you want to convert the value of one data type to another.
2)One use for typecasting for is when you want to use the ASCII characters. For example, what if you want to create your own chart of all 256 ASCII characters. To do this, you will need to use to typecast to allow you to print out the integer as its character equivalent.
1) Type casting does not change the actual value of variable, but the resultant value may be put in temprory storage
2) Type casting is done using a cast operator that is also a unary operator