If we rely on implicit casting, our results may go awry or we may get unexpected results. To avoid this, we can cause an explicit, yet temporary, type change. We do this by casting. When we explicitly cast a variable to another type, its value is temporarily converted into the desired type and then used. The type of the variable and its value does not change.
Any expression can be prefixed by (type) to change its explicit type to the indicated type for the lifetime of the expression. This lifetime is typically a single statement. The explicit type is never changed, nor is the value stored in that explicitly typed variable. An example of this is given in the following program, casting.c:
#include <stdio.h>
int main( void ) {
int numerator = 33;
int denominator = 5;
double result = 0.0;
result = numerator / denominator;
printf( "Truncation: %d / %d = %.2g\n" ,
numerator , denominator...