This method will obviously affect the accuracy of floating-point data, and pay attention to the different forms of final output, and the results will be different. If you want to keep the digital output, it will be in %d format.
Application examples in the program:
Note that different output formats correspond to different outputs.
Extended data:
When using cast, you should pay attention to the following issues:
1. Type specifiers and expressions must be enclosed in parentheses (individual variables can be enclosed without parentheses). For example, writing (int)(x+y) as (int)x+y is equivalent to converting x into int and then adding it to y. ..
2. Whether forced conversion or automatic conversion, the data length of the variable is temporarily converted for the needs of this operation, and the type defined for the variable during data description is not changed.
Baidu Encyclopedia -C language type forced conversion