negating characters in C

c

Solution

The two's complement of -128 in an 8-bit signed value is -128.

Look at the binary values:

Original value: 10000000

Complement: 01111111

Increment: 10000000

Problem

Is this undefined behavior? It prints `-128` as the result: ``` #include<stdio.h> int main() { char i=-128; i=-i; printf("%d",i); } ``` Please explain.

Original source