What does the tilde mean in an expression? [duplicate]

~bitwise NOT operator, basically invert bits

31 in binary format is 11111, so ~31 == 11111111111111111111111111100000, or 0xFFFFFFE0 hexadecimal.

Leave a Comment