Bitwise Complement (~) Operators

This operators is also called one's complement operator. This is an unary operator and inverts all the bits represented by the operand. i.e. if a bit

is 0 it becomes 1 and if it is 1 it becomes 0.
Example:
x = 1000 1100 0110 1010
~x=0111 0011 1001 0101
The use of this operator with AND is to turn of a particular bit.

No comments:

Post a Comment