Explicit type conversion in C | Casting in C
It is the process of converting data type of the output of an arithmetic expression into a user specific data type as per his requirement. The syntax of casting is:
Data_Type is a valid data type of C language in which we want to convert the output of an expression.
Arithmetic_Expression is any valid arithmetic expression of C language.
c=(float)a/b; /*Line 8*/
|In line 8 num1 and num2 are int type variables. so result of num1/num2 should be of int type but due to casting, result would be of float type.|
Best Books of Computer Science