C++ integer overflow

前端 未结 4 1380
小蘑菇
小蘑菇 2020-12-10 20:54

I\'m just starting to teach myself C++, and have begun learning about integer overflow. Out of curiosity I wrote some tests just to see what occurs with certain integer valu

4条回答
  •  暖寄归人
    2020-12-10 21:27

    Read up on two's complement. Basically, once you get to the highest integer that your processor can support and you add 1 to it, it goes into negative numbers by turning on the "sign" bit.

提交回复
热议问题