From what I understand the & operator is similar to the && operator except that the && only checks the second if the first is true, while the & checks both regardless of the result of the first one. Basically the && just saves a little time and power.
If that is so, then how does this code work?
int l = 0;
if ((l & 8) != 0 && (l & 4) == 0){ do something}
what does the (l & 8)
and the (l & 4)
do?
What does the & do in this case?
if ((l & 12) == 8) { do something }
– Capita