Data types in computer science. Integer type

Table of contents:

Data types in computer science. Integer type
Data types in computer science. Integer type

By the end of 2018, there are several hundred programming languages in the world, a minority of them are highly specialized languages, such as, for example, Ada (a language invented by the US Air Force to control ballistic missiles) or Fortran, mainly used in scientific software development. But most of them are publicly available for understanding and study and are widely used.

Data types in computer science are a structural and dimensional characteristic of an allocated memory cell, in which some value can be placed for further operations. One such type is the integer (int) type. This is an integer data type. That is, only an integer (0, 1, 2, 256, 10000, and so on) can be placed in a reserved integer cell.

The range of values that can be put in an integer cell differs in other programming languages and on different processors, for example, in the languagePascal programming ranges from -32768 to 32768. Attempting to "put" data over or under this range will cause a "data overflow error".

Characteristics of the integer data type

On 32-bit architectures, they range from −2,147,483,648 (-231) to 2,147,483,647 (231 −1)

  • Store as an integer.
  • The range varies depending on the choice of programming language and architecture.
integer variable
integer variable

There are integer types, without signs. For example, unsigned int in C. Misuse of these data types can lead to errors.

There are also various variations of the integer type, such as:

  • short int - provided to reduce the amount of memory allocated for the needs of the programmer.
  • long int - on the contrary, it was created for those who are afraid that during the course of the program there is a risk of "flying out" of the usual int and getting a "data overflow error".

Types integer, real, dint (in Pascal language) refer to mathematical data types. This means that it is possible to perform mathematical operations - addition, multiplication, subtraction, division.

Characteristics of type integer real

To store a real number in RAM, six bytes of memory are allocated, so calculations are always performed with finite precision, depending on the format of the number. Real data is stored as a floating decimal point integer.

Other data types in popular programming languages

Data types
Data types

Char - character data type, can store 1 character from the ASCII character table. It takes 1 byte and is interpreted as an ASCII character.

String - string data type, usually represented by an array of char objects. Usually, the capabilities of modern languages allow you to perform a wide variety of actions on objects of type string, for example, concatenation (gluing), deleting strings, replacing characters in a string.

Boolean - Boolean data type. A primitive data type in computer science that expresses 2 states. Very useful when you need to express only 2 states in a program (for example, write a function that would return only true or false).

Type casting

Programming languages allow you to "cast" types to each other. For example, by initializing a variable of type integer, we can later cast it to type double, that is, allow the compiler to overwrite it and treat it later as a floating point number.

But not all data types can be converted so easily. For example, we will not convert string to integer in any way, the compiler simply will not understand our actions. There are also special cases of compilers and programming languages. For example, Pascal cannot convert integer to integer real because only real supports division.


Modern languages like C don't have these problems, most often a programmer can painlessly convert intuitively similar data types like int. double,long int and so on. Moreover, in dynamically typed languages it is even possible that the char data type is cast to int!

This is allowed because the compiler, instead of working with a character, takes its serial number from the ASCII table and already uses it to interact with int. In strongly typed languages such as C++ or C, this is of course not possible.

Object Oriented Programming
Object Oriented Programming

These are the basic data types in computer science. In modern programming languages, variables are often no longer just an allocated place in RAM, but entire "objects" or "classes", which greatly expands the possibilities of operations with them.

To understand how such complex structures are stored, you need to delve into such an inexhaustible topic as object-oriented programming, the most modern tool for creating powerful, extensible and maintainable programs for years.

Popular topic

Editor's choice

  • Restore Skype account: step by step instructions, return access to your account
    Restore Skype account: step by step instructions, return access to your account

    Don't know how to recover your Skype account? Or do you want to know your friend's Skype password? The article discusses several ways to restore the user's page, as well as recommendations for storing and selecting pin codes

  • Why can't I follow on Instagram? All possible reasons
    Why can't I follow on Instagram? All possible reasons

    We subscribe to people with a specific goal - to find friends, like-minded people of interest, to learn something new for ourselves. And sometimes it is very strange to see that the Instagram system does not allow you to "follow" the profile you are interested in. This error occurs quite often, no one is immune from this trouble. Let's analyze the main reasons why Instagram does not allow you to subscribe to people

  • How to find out who "liked" a person on Instagram. Proven Methods
    How to find out who "liked" a person on Instagram. Proven Methods

    Everyone who is trying to start the path of a blogger or has already achieved some success in this field, hopes that the content that he shares with readers will not be left without attention. The main indicator of page popularity is “likes”. “Thumbs up” is also put when they want to attract the attention of potential subscribers

  • How to restore a channel on YouTube: detailed instructions, simple and effective tips
    How to restore a channel on YouTube: detailed instructions, simple and effective tips

    This article describes how to restore a channel on YouTube after deleting it. To understand this task, it will be useful to familiarize yourself with some terminology. There is a difference between deleting and blocking a YouTube account

  • How to remove a contact from "Vatsap" and how to block an unwanted interlocutor
    How to remove a contact from "Vatsap" and how to block an unwanted interlocutor

    WhatsApp is a popular messenger. It has many features that users are not even aware of. One of these is the ability to block contacts. It helps to get rid of annoying interlocutors. And how to remove a contact from WhatsApp and how to block it? You can perform these actions in different ways