An integer is a whole number without any fractional or decimal component. Integers can be positive, negative, or zero, and they are one of the most common primitive data types in programming languages. Because integers have a fixed range determined by the language or system architecture, they can overflow if calculations exceed their limits. Integers are frequently used for counters, indexes, identifiers, and mathematical operations.
Why it matters
Integers are foundational to algorithms, data structures, and control flow. They are used everywhere—from array indexing to representing IDs in a database. Understanding integer behavior helps avoid bugs such as overflow, rounding issues, or incorrect comparisons.
Examples
Values like 0, 42, and −7 are integers. Lessons like Common Data Types introduce how integers differ from floats and strings.