Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - 24. The following variables are defined and assigned specific values: char w; int x; float y; double z; then the expression: the number obtained by w*x+z-y
24. The following variables are defined and assigned specific values: char w; int x; float y; double z; then the expression: the number obtained by w*x+z-y

Because * has a higher priority than + and - and the arithmetic operator is left associative, we do w*x first, where w is of type char. According to the rules of C language, it must be unconditionally converted to int type. x is an integer, multiplied by w, the result is an integer. The next step is to find w*x+z. Since z is a double type, the int type value obtained by w*x will be converted into a double type. In the next step, since y is of type float, it must be unconditionally converted to type double before it can participate in the operation of w*x+z-y. w*x+z is of type double, and y is also of type double, so the difference between these two numbers is still of type double.