Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - In C language, integer variables X=1 and Y=3. After calculation, the value of X is not equal to 6: X = Y > ? 6:5 C:x=9-(-y)-(y-)
In C language, integer variables X=1 and Y=3. After calculation, the value of X is not equal to 6: X = Y > ? 6:5 C:x=9-(-y)-(y-)

choose b?

because X=Y> ? Middle Y> ? It is a judgment statement, so either x equals 1 after judgment; Or x equals .

that is to say, Y> ? If established, x is 1;

if Y> ? If it doesn't hold, x is .

if it is-y, first of all,-of the same variable appears twice in an expression. Different compilers may handle it differently, and usually give a warning that y is undefined. If you really want to calculate, calculate the parentheses first according to the priority of the operation symbol, so y is equivalent to performing x = 9-y-y after subtracting twice;

extended data:

the type specifier is short int or short'C11F1. The bytes occupied and the range of values will be different for different compilation systems. For a 16-word machine, short int accounts for 2 bytes, and in most 32-bit machines, short int accounts for 4 bytes. But overall, short int is at least 16 bits, that is, 2 bytes.

the type specifier is long int or long, which takes up 4 bytes in memory, and its value is a long integer constant. In any compilation system, long integers account for 4 bytes. In general, its number of bytes and range of values are the same as those of the basic type.

Baidu encyclopedia-integer variable