/** * implicit conversion * num_conversion.c * Stephanie Taylor */ #include int main () { int d = 2000000002; // 2 billion char c = 1; printf( "d is %d\n", d ); int sum = c + d; // the int is big enough to hold the answers. char char_sum = c + d; // the char is expanded to an int, the addition is done, and the result is truncated. printf( "sum is %d %d\n", sum, c+d); printf( "char sum is |%c| %d\n", char_sum, char_sum ); float b = 1.9; int stephanie = b; // implicit conversion to an int leads to truncation of the fractional part printf( "b is an int %d\n", stephanie ); int prod = b*3; // the multiplication is done with floats, then the result is truncated to an int printf( "prod is an int %d\n", prod ); }