Hello, I've been looking at binary operators lately.. And I don't quite understand some of them..
I know how to use bit shifting but I don't understand the rest.. like the logical operator (&) and the xor ^
Could anyone explain?
Bitwise AND (&) will only execute if both the first AND second are true.
Example:
0 & 0 = 0
0 & 1 = 0
1 & 0 = 0
1 & 1 = 1 |
Bitwise XOR is e
Xclusive
OR. It will only execute if both arguments in question are opposite (i.e. one is true, and the other is false).
Example:
0 ^ 0 = 0
0 ^ 1 = 1
1 ^ 0 = 1
1 ^ 1 = 0 |
Last edited on
Oh okay... Thanks! That was really helpfull :)