Cast Operatorsuggest change
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
double, too, and the result of the division, a
double is passed to
printf for printing.
Found a mistake? Have a question or improvement idea? Let me know.
Table Of Contents