The output of this program is -13. I have never fully understood ~ operator in C. Why does it give -13 as output? How to limit ~ operator to just 4 bits of a number?
<
The ~ operator acts as a binary NOT, that is, it flips all the bits in the number. Negative numbers in signed integers are stored as two's complement.