M
mdh
If one searches the forum for bitwise operators there are numerous
questions and very good answers to the perenial question about what
these operators do and why we need them.
So, having looked at all these, I approached K&R 2.9 headily!! ...but
not for long :-(
Quote:
The bitwise AND operator & is often used to mask off some set of bits;
for example,
n=n & 0177;
sets to zero all but the low-order 7 bits of n.
End Quote;
Could someone perhaps just demonstrate this with an example? (I have
tried to make sense of the fact that 0177 is, I believe '10110001'.
However this has not gotten me very far.
Thanks in advance.
questions and very good answers to the perenial question about what
these operators do and why we need them.
So, having looked at all these, I approached K&R 2.9 headily!! ...but
not for long :-(
Quote:
The bitwise AND operator & is often used to mask off some set of bits;
for example,
n=n & 0177;
sets to zero all but the low-order 7 bits of n.
End Quote;
Could someone perhaps just demonstrate this with an example? (I have
tried to make sense of the fact that 0177 is, I believe '10110001'.
However this has not gotten me very far.
Thanks in advance.