The tilde operator in C

Solution 1:

The ~ operator is bitwise NOT, it inverts the bits in a binary number:

NOT 011100
  = 100011

Solution 2:

~ is the bitwise NOT operator. It inverts the bits of the operand.

For example, if you have:

char b = 0xF0;  /* Bits are 11110000 */
char c = ~b;    /* Bits are 00001111 */

Solution 3:

This is the bitwise NOT operator. It flips all the bits in a number: 100110 -> 011001

Solution 4:

The tilde character is used as an operator to invert all bits of an integer (bitwise NOT).

For example: ~0x0044 = 0xFFBB.