Data types

Martin McBride, 2017-02-06
Tags none
Categories none

Computers deal with data of various different types. Here are some of the main ones.


In maths, we often make a distinction between whole numbers (integers) and real numbers. Integers are used for counting and ordering things:


Real numbers are used for things we might measure:


In computing, we also have two number types.

Integers, which store whole numbers (which can be positive, negative or zero). We will call this type an INT.

Integers are usually stored as binary words, often 4 or 8 bytes long.

Floating point numbers, which store real values, including fractional values. We will call this type a FLOAT.

Floats values have a large range (they can store number which are very big, or very small, or anywhere in between), but they have limited precision - usually they only hold about 15 significant figures (just like most pocket calculators).

You might also see the Boolean data type. This type is used to store logical values, either TRUE or FALSE. You might not think this is a number, but usually it is: FALSE is stored as 0, TRUE is stored as a non-zero value.


Strings are used to store text data. For example:

"Hello world!"

A string is made up of characters. Each character is a single letter, number, or punctuation mark. In the example above, the quotation marks are not part of the string itself, they are just used to mark the start and end of the string.

In our pseudocode, we will call this type STRING.

Some languages also have a character type, which we will call CHAR, that can store a single character.

{{% yellow-note %}} Python doesn't have a character type. To represent a single character, it just uses a string which is only 1 character long, for example "a". {{% /yellow-note %}}


An array is used to store a list of related values. For example, this array holds the amount of rainfall per day (in mm), each day for the last week:

[0, 1, 3, 0, 0, 7, 2]

Arrays usually have a type - this is an array of integers, so we would call it an INT ARRAY in our pseudocode language.

Copyright (c) Axlesoft Ltd 2021