int flags = 22 | 225 | 222;
what is this code i don't understand what's happens>>
int flags = 22 | 225 | 222;
what is this code i don't understand what's happens>>
22, in binary 0000000000010110
225, in binary 0000000011100001
222, in binary 0000000011011110
|
is binary OR
operator:
The binary OR operation has two inputs and one output. It is like the ADD operation which takes two arguments (two inputs) and produces one result (one output).
A B C
0 OR 0 -> 0
0 OR 1 -> 1
1 OR 0 -> 1
1 OR 1 -> 1
0000000000010110 | 0000000011100001| 0000000011011110 = 0000000011111111 (in decimal 255)
| is Bitwise Operators
so here you added 22 + 225 + 222 in binary way