Unsigned int x =123;
1, output cast, such as:
printf("%f ",x); //Because the types of %f and x are different, the output data is abnormal.
printf("%f ",(float)x); //Forced conversion to floating-point type can output correctly.
2, stored in the corresponding variables, such as:
Floating point fVal
fVal = x; //The system will implicitly convert because the most significant bit of float is 7, so not all integers can be represented by float type variables, so it is better to use double type to store any integer.
printf("%f ",fVal); //The output is normal
Double dVal
dVal = x; //The system will convert implicitly.
printf("%f ",dVal); //The output is normal