C integer overflow
问题 I was working with integers in C, trying to explore more on when and how overflow happens. I noticed that when I added two positive numbers, the sum of which overflows, I always got a negative number. On the other hand, if I added two negative numbers, the sum of which overflows, I always got a positive number (including 0). I made few experiments, but I would like to know if this is true for every case. 回答1: Integer overflows are undefined behavior in C. C says an expression involving