Performs an explicit conversion into the given type from the value resulting from evaluating the given expression.
int x = 3;
int y = 4;
printf("%f\n", (double)x / y); /* Outputs "0.750000". */
Here the value of x
is converted to a double
, the division promotes the value of y
to double
, too, and the result of the division, a double
is passed to printf
for printing.