Two's complement represents a negative integer by applying the same bit arithmetic used for unsigned integers and interpreting a representation with a high-order 1 as negative. For an unsigned value A, its negation is computed as ~A + 1. The sign bit is 0 for nonnegative values and 1 for negative values. section 5.7.5
Negating 240 in 16 bits
Start with A = 240, represented as 0000000011110000. Complement every bit to obtain ~A = 65295, or 1111111100001111. Add one: ~A + 1 = 65296, represented as 1111111100010000. Under two's complement interpretation, that bit pattern represents -240. section 5.7.5
Keep these distinctions in view:
- C permits sign-and-magnitude, ones' complement, and two's complement representations; the first two permit both positive and negative zero. section 5.7.5
- Fixed-width intN_t types, when provided, use two's complement, have exactly N bits, and provide N − 1 bits of value precision. section 5.7.6



