previous | start | next

1's complement operator



unsigned char x = 0x1C;
In binary x's value:  00011100
          ---------- ---------
              ~x   :  11100011

In hex x's value: 0x1C
       ---------  --
           ~x   : 0xE3

(In decimal, ~x = 227 and x = 28)

The ~ operation is performed on each bit position k of its operands to
produce the bit value in the k-th position of the result. The result
bit is determined by the table

                  result bit
                 ------
   operand bit 0| 1
               1| 0  

For an integer x, what is ~~x?



previous | start | next