N
noridotjabi
I have often times seen masks used in C source code. I really don't
understand the purpose or functionality of this. I have seen used:
#define MASK 0x77
....
if(hello & MASK)
Also I don't (yes still don't) understand the purpose of the bitwise
operators. I understand there are times when you may pass to a
function:
func(ONE | TWO | THREE);
To pass those three options. What I don't understand is what that
means, what it is doing, and how the function knows that you passed
ONE, TWO, and THREE and not some value just equal to ONE | TWO | THREE
and another thing is what if ONE | THREE == TWO | FOUR. What then?
Mainly I just don't understand WHY a mask would be used, or why a
bitiwise operator would be used. I'm pretty sure I understand what a
bitwise operator does I just don't know why you would EVER need that
done. Thanks in advanced to anyone who helps someone who is thoroughly
confused.
Nori
understand the purpose or functionality of this. I have seen used:
#define MASK 0x77
....
if(hello & MASK)
Also I don't (yes still don't) understand the purpose of the bitwise
operators. I understand there are times when you may pass to a
function:
func(ONE | TWO | THREE);
To pass those three options. What I don't understand is what that
means, what it is doing, and how the function knows that you passed
ONE, TWO, and THREE and not some value just equal to ONE | TWO | THREE
and another thing is what if ONE | THREE == TWO | FOUR. What then?
Mainly I just don't understand WHY a mask would be used, or why a
bitiwise operator would be used. I'm pretty sure I understand what a
bitwise operator does I just don't know why you would EVER need that
done. Thanks in advanced to anyone who helps someone who is thoroughly
confused.
Nori