I saw some very neat usage of '&' like:
another example is:
Can anyone explain to me how '&' works?
I tried to use cout<< to figure it out. For (k&2), result=0 when k=0, or k=1. If k>=2, it returns 2.
For (k&1), seems like when k is an odd number, it returns 1, otherwise, it returns 0.
Is that about right? Would you please give me more examples, so I can learn this trick.