What happen when we exceed valid range of built-in data types | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

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

18th Jan 2021, 3:37 PM
Giriraj Yalpalwar
Giriraj Yalpalwar - avatar
2 Answers
+ 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.
18th Jan 2021, 4:14 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 2
Signed integer overflows evoke undefined behavior, while unsigned overflows are mathematically defined (they wrap around).
18th Jan 2021, 9:46 PM
Mike A
Mike A - avatar