What is an Integer
A basic data type, but what is it?
A simple question. Some might say “whole number”, but that only tells half the story. Read on for more information.
Difficulty: Beginner | Easy | Normal | Challenging
Prerequisites:
- None, although some knowledge of Binary would be useful (Guide: HERE)
Terminology
Data types: A representation of the type of data that can be processed, for example Integer or String
Integer: A number that has no fractional part, that is no digits after the decimal point
Two’s Complement: The complement of a binary number with respect to 2^n
Integers:
A simple definition:
An Integer
is a whole number. This means that 0, 3, 10, 12932 and -12 are all Integers
, meaning that Integers can be both positive and negative numbers.
However, since Integers
are whole numbers this means that the lack decimal places.
Integers
are commonly used in programming languages, and we will see some ways that they are used below.