/* --------------------------------------------------------------------- // Figure 7.22: Type coercion. // --------------------------------------------------------------------- */ #include #include void main( void ) { float x = 17.7; float t, w; int k; k = x; /* A. The assignment coerces the float value to type int. */ t = k + 1.0; /* B. The + coerces value of k back to type float. */ w = sin( x ); /* C. Calling sin() coerces x to type double. */ /* C. The = coerces the double result of sin() to type float. */ printf( "x= %.2f k= %3i t= %.2f w= %.2f\n", x, k, t, w ); }