Byte is the lowest level at which we can access data; there is no "bit" type.
And also it is not possible to perform operations on a single bit -- every bitwise operator will be applied to, at a minimum, an entire byte at a time.
Bit n of a&b is 1 if bit n of a and bit n of b is 1.
Bit n of a|b is 1 if bit n of a or bit n of b is 1.
Bit n of a^b is 1 if bit n of a or bit n of b is 1 but not if both are 1.
Bit n of a>>s is bit n-s of a.
Bit n of a<<s is bit n+s of a.
bitwise Exclusive OR (XOR): if either one or the other of the inputs is a 1 the exclusive-or operator returns 1, but not if both are. That is, if both inputs are 1 or both inputs are 0, it returns 0.
Bitwise exclusive-or, with the operator of a carrot, ^, performs the exclusive-or operation on each pair of bits.
It's a kind of selective twiddle(~).So, if we do XOR against 111...1111, all the bits of TestBits flipped. Which is the equivalent of doing twiddle(~).
See the another sample for more understanding: Write a macro with two arguments a and pos, where a is a byte and the pos specifies a bit position of the byte. The macro should clear the particular bit position in the given byte.
unsigned char Test = dVal & (1 << n); //dVal has the byte value.