TYPE CONVERSION (CASTING) IN C++


For type conversion ( casting ):

when a value of one data type is automatically changed to another data type then implicit type coercion occured.
To avoid implicit coercion , c++ provides cast operator used for convertion.

For converting a integer value into floating type value then we have to use this conversion

static_cast <double> (12) evaluates to  12.0

For converting a double type value into integer value then we have to use this conversion

static_cast <int> ( 9.7 ) evaluates to 9.

for this method we can conclude all values.