Data Types

Data types define the structure of data in programming language.and also it is an attribute of data. Data types are generally associated with variables.Data type decrease the coding stuff in system level.
Example : integer , character, string , bool ,float ,double etc

Generally Data types is categorized into two types :

  • Primitive Data Types or System Designed Data Types
  • User defined Data Types.
This image has an empty alt attribute; its file name is DT1.png

Primitive Data Types

Computer System already have some basic data types like int, float ,char and bool etc are called primitive or system defined data types.
Every data types have some assigned number of bits which can be vary system to system also depend upon compiler bit structure or system bit structure.
Example : for 32 bit system , int size is 2 byte and char is 1 byte.
for 64 bit system ,int size is 4 byte and char size is 2 byte.

User defined Data Types

When primitive Data types lost their scope then we need User defined data types to manipulate the data as per the our requirements.
Most of the Programming language provide the user defied data types to the software developer to design their own data types.
Example : Structure ,Union ,Classes etc are the User defined data types.

Abstract Data Types

  • Primitive Data types are already associated with their basic operation or basic implementation like addition,subtraction and multiplication etc. These implementations are already defined by system.
    Example : 2 + 6 =8 ,here + Operator is associated with Addition Operation which is provide by system, means no need to define the operation between 2 and 6.
This image has an empty alt attribute; its file name is DT2.png
  • But for User defined data types we need to define operation along with data.if we want to use user defined data types then operation must be define.otherwise there is no meaning of User-defined data types.
  • If we associate data structure along with their operation/implementation then it is called Abstract Data Types(ADT).
    ADT have two parts :
    1- Data Declaration
    2- Operation

Example : If we want to use the Stack, then we have to define their operation like PUSH and POP etc ,otherwise How can i use Stack?. only declaration of data is not enough for User Defined Data Types.we need Operation on data.

This image has an empty alt attribute; its file name is DT3.png

Here 2 is data ,and PUSH(2) is operation on stack ,without PUSH(2) operation data 2 doe’st have any meaning.

Leave a Reply

Your email address will not be published. Required fields are marked *