Home » Computer Basics

What is Data Type in Computer programming languages?

Learn: What are the data types in computer programming languages, what are the workings of the data types and what they tell to the compiler?

In computer programming languages, a data type defines the type or/and behaviour of a data, it tells to the compiler about the type of data which is going to be stored and the compiler reserves the fixed number of bytes for that particular variable/constant.

Thus, we can say that, a data type defines two things:

  1. Type of data
  2. Memory blocks to be reserved for the data

Let suppose, In C programming language, there is a variable declared and defined like this: int x=10; This statement will tell to the compiler to reserve 2/4 bytes (depending on the compiler architecture) bytes in the computer memory for variable x and restrict to those memory blocks to accept only integer values.

Example: C language data types: int, float, char, struct, union etc

There are basically two types of data types in most of the computer programming languages:

  1. Basic/primitive data types
    These are the most basic data types to store basic values like integer, character, float, Boolean (in C++, java and other programming languages).
  2. Derived/non-primitive data types
    These are the data types, which are created with the help of basic data types like structures, arrays, union in C language.

Comments and Discussions!

Load comments ↻

Copyright © 2024 www.includehelp.com. All rights reserved.