Stage 3 · Lesson 3 of 9
Integers and overflow
In most languages, integers are stored in a fixed number of . A 32-bit signed int holds roughly minus 2.1 billion to plus 2.1 billion, and a 64-bit one about 9.2 × 10^18. Negative numbers use , a scheme where the top bit acts as the sign.
Go past the limit and you get . Java and C# wrap silently to a large negative number by default, and in C++ signed overflow is . Python integers grow as large as memory allows.
JavaScript numbers stop being exact above 2^53, which is why BigInt exists. Overflow bugs show up in money totals, and counters, so know the limits of the types you use.
A question to check yourself, an AI practice session and 2 cheat sheet entries come when you add the roadmap to your account. Add it
Resources for this stage
Start with· follow one of these
- CourseFreeCS50: Introduction to Computer Science
Harvard University · Beginner
Weeks 0, 1, 2 and 4 teach C, arrays and memory; the difficulty is the point
- VideoFreeCrash Course Computer Science
CrashCourse · Beginner
Short free videos from logic gates to operating systems; episodes 1 to 20
Keep handy
Also worth your time
- What Happens WhenGo deeper
Everything from a key press to a rendered page; read it after this stage