I have a problem with flag bits.
I have an int variable to hold flags. First I set some flags to that variable. Later I need check how many flags were set in that variable. But I don’t know to do it.
I have a problem with flag bits. I have an int variable to hold
Share
To check to see if a bit value is set:
It’s important to note that you should not have a checked value as 0 unless it represents All or None (and don’t use bitwise logic to compare; just use
value == 0) because anyvalue & 0is ALWAYS 0.