Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - C language unsigned integer uint?
C language unsigned integer uint?
This involves a problem of default type conversion.

Usually, unsigned variables and signed variables are operated, and the results will be aligned to signed, char and int variables, and the results will be aligned to int, that is, the results will be int. However, the operations of float type variables and int type variables will lead to float type alignment, and the others are similar.

In the above problem, temp variable is of unsigned int type, while constant 0.0625 is of float type. The result of temp*0.0625 will be aligned with the signed float type, that is, the result will be float type and assigned to an unsigned int variable, which will make some trade-offs, such as the decimal part will definitely not be retained. Finally, temp got the integer part of the operation result.