What happen when we exceed valid range of built-in data types | SoloLearn: Learn to code for FREE!

+1

What happen when we exceed valid range of built-in data types

You will understand what mean please see the code👇 https://code.sololearn.com/cHh2gHBoj8vm/?ref=app

1/18/2021 3:37:53 PM

Thirt13n

2 Answers

New Answer

+3

In C/C++ values are represented as binary numbers and not checked for invalid ranges. This means that the signed 8 bit value 127 plus one is -128 because the addition causes an integer overflow.

+2

Signed integer overflows evoke undefined behavior, while unsigned overflows are mathematically defined (they wrap around).