Use of Data Types

One of the fundamentals of understanding how program code works is understanding the use of data types when declaring variables.

data types - GCSE Computer science

You may also see the term data types used when discussing databases, and it’s important to remember that some of the names for data types differ between the two topics.

In programming theory, there are five major data types that you will need to be able to identify and use in your programs:

  • Char
  • String
  • Integer
  • Real
  • Boolean


A char is a single character. Characters can be alphabetical, numeric, or symbols and are generally from the ASCII character set (or Unicode for more complex programs).

Using a char data type is useful when each character of a word or phrase needs to be checked. For example when calculating the strength of a password, or checking that an email address meets the required pattern.


A string is a combination of characters in a word or phrase. In some older programming languages strings are declared as arrays of characters. Strings are one of the most common data types in programming and for some languages, all user input is initially treated as a string.

String manipulation is the process of analysing or changing string variables and is a large part of the programming topic.



You may recognise the term integer from your maths lessons, and in Computer Science it means exactly the same thing – data that is a whole number. When asked to define an integer in your exam, it is important to clearly state that the number is whole as just stating number is not specific enough.


A real number is the technical term for a decimal number in Computer Science. You may have seen them referred to as a float in programming languages – this is also a correct term in many languages.

Real numbers often need to be rounded or truncated (cut off) before they are output to the screen as a real number may contain an infinate number of numbers after the decimal point.



A boolean data type holds either a True or False value. The unusual name comes from the British mathematician, George Boole who developed the concept of reducing all logic down to a simple true or false value.

You’ll come across this in action in the Boolean Logic topic.

Looking for More?

Sign in to access the following extras on this page for members: Notes


A Level Content

Looking for something else? Check back soon as new resources are added every week!

Not a member yet? Sign Up or Log In below