The ~ operator is bitwise NOT, it inverts the bits in a binary number:
~
NOT 011100 = 100011
~ 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 */
This is the bitwise NOT operator.It flips all the bits in a number: 100110 -> 011001