In C, a variable has an automatic conversion of the type when it is evaluated or assigned. The general situation is no longer discussed here, just say the assignment and use the printf function when printing the situation
1. Automatic conversion when assigning a value
int a = 1.5;
printf ("%d", a);
The output value is 1 because 1.5 is a double type, but when assigned to a, because a is an int type, the fractional part is put out, A is 1
Automatic conversion not involved in 2.printf functions
He only prints in a fixed format, and if parsing fails, it outputs 0 of the corresponding format
For example:
int a = 1;
printf ("%f", a);
Output 0.000000 because A is of type int, parsing fails with the float type, so 0 of the output floating-point format is 0.000000
The rest of the similar, such as%c fails to parse the output of a space,
C--The printf function parameter type and print format do not match