Skip to content

运算符

Assignment Operators

OperatorExampleSame As
=x = 5x = 5
+=x += 3x = x + 3
-=x -= 3x = x - 3
*=x *= 3x = x * 3
/=x /= 3x = x / 3
%=x %= 3x = x % 3
&=x &= 3x = x & 3
|=x |= 3x = x | 3
^=x ^= 3x = x ^ 3
>>=x >>= 3x = x >> 3
<<=x <<= 3x = x << 3

位运算符

pqp & q~p~qp ^ q
000000
010111
111100
100111

~ 取反运算符,按二进制位进行"取反"运算

吃好喝好 快乐地活下去