Note that the scanf and printf functions are unusual functions in that neither limits the function's arguments to a fixed number. The scanf function and printf function have variable length parameter lists. When calling a function with a variable-length parameter list, the compiler will arrange for the float parameter to be automatically converted into a double type. As a result, the printf function cannot distinguish between float and double type parameters. Therefore, in the printf function call, %f can represent both float and double parameters. On the other hand, the scanf function points to a variable through a pointer. %f tells the scanf function to store a float value at the passed address location, and %lf tells the scanf function to store a double value at the passed address location. The difference between float and double is very important here. If the wrong conversion specification is given, the scanf function may store the wrong number of bytes (it is not mentioned that the bit pattern of a float may be different from the bit pattern of a double). The answer is here Search before asking
If CPP can be used, iostream will be easier to use
Note that the scanf and printf functions are unusual functions in that neither limits the function's arguments to a fixed number. The scanf function and printf function have variable length parameter lists. When calling a function with a variable-length parameter list, the compiler will arrange for the float parameter to be automatically converted into a double type. As a result, the printf function cannot distinguish between float and double type parameters. Therefore, in the printf function call, %f can represent both float and double parameters.
On the other hand, the scanf function points to a variable through a pointer. %f tells the scanf function to store a float value at the passed address location, and %lf tells the scanf function to store a double value at the passed address location. The difference between float and double is very important here. If the wrong conversion specification is given, the scanf function may store the wrong number of bytes (it is not mentioned that the bit pattern of a float may be different from the bit pattern of a double).
The answer is here
Search before asking
If CPP can be used, iostream will be easier to use
If you can double, try not to use float. Although it takes up a bit of memory, try not to mix the two