EDDYMENS

Last updated 2022-11-05 03:50:45

What Is Data Type?

Table of contents

Definition

You will notice a grouping pattern when you think of what you can do with any type of data, say age, company name, date, etc.

I can ask you to add two ages together, and it will make sense, but try adding up two dates, and you will have many questions. The same way, the capitalization of numbers makes no sense.

The groupings that emerge are numbers, text, dates, and it's because of their characteristics.

Your age and credit card can be used in numeric computations, so belong to the numbers group. This is what data types are all about.

Data types are fundamental to computers because defining them helps compilers [→] better instruct the computer to manage computer memory.

Use Cases and Examples

Depending on the programming language [→] you work with, you may end up with a further breakdown of data types. For example, in most languages, there are integer types for whole numbers e.g: 1 and floats for decimal numbers e.g.: 1.234.

And some languages break down text/strings into CHAR, VARCHAR, TEXT, which informs the size of the string to be stored ahead of time. This way, the computer knows how much RAM space to allocate to it.

Other programming languages handle the detection of the right data type and memory allocation by analyzing the data itself.

Summary

There are many data types even within a single programming language. Some data types represent a collection of other data types.

It is worth knowing which data types your programming language of choice supports and how to use them effectively.

Here is another article you might like 😊 "Diary Of Insights: A Documentation Of My Discoveries"