# Include <stdio. h> int main (INT argc, char * argv []) {unsigned char a = 0xa5; unsigned char B = ~ A> 4 + 1; printf ("% d", B); Return 0 ;}
Evaluate the output result.
This question is mainly about the operator priority.
Because> the priority is lower than +, the answer to this question is 250. (because a exists in a 16-bit register, it is not 2 ).
C language operator priority and tips
A total of 15 priorities:
1 () [].->
2! ~ -(Negative sign) ++ -- & (take the variable address) * (type) (force type) sizeof
3 */%
4 +-
5 >><
6 >>=<=
7 =! =
8 &
9 ^
10 |
11 &&
12 |
13? :
14 = + =-= * =/= % = | = ^ = & gt; = <=
15,
Parentheses are the first member. // brackets operator [] () member operator.->
Second for all single object; // All single object operators, such as ++, --, + (positive),-(negative), pointer operation *, & multiplication and division, and addition and subtraction; // This "remainder" refers to the remainder operation, that is, %
Shift 5, relation 6; // shift operator: <>>, relation: ><>=
Equals (and) to the seventh row; // that is, = and! =
Bitwise AND exclusive or bitwise OR; // these operations are bitwise operations: bitwise AND (&) exclusive or (^) bitwise OR (|)
"Three parts of the World" 80 or 90;
Logical or heel; // logical operator: | and &&
12 and 11; // attention sequence: Priority (|) at the bottom of priority (&&)
The condition is higher than the value assignment. // the priority of the Three-object operator is 13 BITs, which is only higher than the value assignment operator and ","
The lowest comma operation level! // The comma operator has the lowest priority.