If I use this: if(value & 4) to check if the bit is set, then how do I check if the bit isn\'t set?
if(value & 4)
I tried with if(!value & 4) or
if(!value & 4)
When you write if(value & 4), C checks the result to be non-zero. Essentially, it means
if((value & 4) != 0) { ... }
Therefore, if you would like to check that the bit is not set, compare the result for equality to zero:
if((value & 4) == 0) { ... }