Cast Operator
suggest changePerforms 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 double, the usual arithmetic conversions convert y to double as well, and the double result is passed to printf.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents