Explicit type conversion in C | Casting in C
It is the way to convert the output of an arithmetic expression into a specific data type. The syntax of casting is:
Data_Type is any data type of C in which we want to convert the output of an expression.
Arithmetic_Expression is any arithmetic expression of C which we want to convert into a particular data type.
|Program for explicit conversion.|
c=(float)a/b; /*Line 8*/
|In line 8 a and b int type variables. so result of a/b should be of int type i.e. 2 but due to casting by float result would become 2.75.|
Best Books of C