How a negative integer is stored in C ?

Negative integers are stored using 2’s complement. Two’s compliment is obtained by doing 1’s compliment and adding 1 to it.

e.g.

For storing -14
In binary 14=1110

Step 1 : 1’s complement  —>   0001
Step 2 : Adding 1 —>  0010

Leave a Reply

Your email address will not be published. Required fields are marked *