A data type that represents an integer. An integer is a whole number that can be negative, positive, or zero. (i.e. ...-2, -1, 0, 1, 2...) Use this tag for questions about using, storing, or manipulating integers.
int
is a data type that represents an integer (a whole number - not a fraction).
int
data types may vary based on:
- the number of bits used to represent them - 16, 32, etc.
- whether they allow both negative and positive values (signed integers) or only positive (unsigned integers).
In many (but not all) languages, integers are limited to a specific range due to the way they are stored - for instance, an ISO C 32-bit signed integer can store values from −2,147,483,648 to +2,147,483,647 (-2³¹ to 2³¹-1).
This keyword is often used in C-like languages (including C, C++, Golang, etc.)