+ 2
Can someone explain the output?
2 ответов
+ 6
5 = 101 in binary
9 = 1001 in binary
10 = 1010 in binary
The | (bitwise or) operator returns 1 if either of the bits is 1
so,
5 | 5 = 101 | 101 = 101 = 5
10 | 9 = 1010 | 1001 = 1011 = 11
5 + 11 = 16
0
Thx a lot... now i understand