Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - C language printf function, float floating point int integer type conversion problem! ! ?
C language printf function, float floating point int integer type conversion problem! ! ?
Printf is a formatted output The output variable type and format must match. Bbb is a floating-point number. If you press %d, the output will be wrong. Your example just illustrates this point, which not only makes mistakes in itself, but also causes output traffic errors.

Press %d to output, and add (int):

printf("%d\n%f\n%f\n ",(int) bbb,(float)aaa,2.3);