can somebody explain how does this condition work and why? I have look evrywhere but i can't find an answer, just examples that uses it but without explaining it.
if((i>>j)&1==1)
Thanks!
can somebody explain how does this condition work and why? I have look evrywhere but i can't find an answer, just examples that uses it but without explaining it.
if((i>>j)&1==1)
Thanks!
It's the bitwise right-shift operator.
It shifts each bit in its left operand to the right by the number of bits dictated by the right operand.
For example:
int a = 6; // binary 0110
int b = a >> 1; // binary 0011, which is 3 in decimal.