The bitwise complement (~) operator works with bits and used
for inverts the bits of a operand or a variable. It is a unary operator so it
works with only one operand. The inversion of bits means, it convert the bit
value from 0 (zero) to 1 (one) and from 1 (one) to 0 (zero), for example:
X = 1010110
~X = 0101001
The bitwise complement operator is also called one’s
complement operator. It is used at the beginning of an operand.
Sy:
~ operand;
Ex:
z = ~x;
No comments:
Post a Comment