float d = 5.6, e = 8.4;
c = d + e;
printf("c = d + e = %.2f \n", (float)c);
Isn't float d=5.6 and float=8.4 automatically converted to int, so it becomes 5 and 8, respectively?
c=5+8=13 does not come out, and the value keeps coming out as 14...
In c=d+e;, the = operator has the lowest priority.
Therefore, d+e is calculated first, and then the result is substituted for c.
That is, 14.0 which is the sum of 5.6 and 8.4 is substituted for c.
7 ipynb code content search tool recommendation
9 I have a question for Python restrictors.
6 Python basic questions: (pyautogui) and errors
7 I have a question about the pointer! *z = ~(hap & 0xFF); What does ~ mean in?
9 I'd like to specify a specific order when selecting Python characters randomly, is it possible?
© 2022 pinfo. All rights reserved.