Data type is a system to define basic properties and operations allowed on the data. Properties such as – acceptable values, range, bytes required in memory etc. Data types can be further classified in three primary categories.
- Primitive data type
- Non-Primitive data type
- Abstract data type (ADT)
Primitive Data Type | Non-Primitive Data Type | Abstract Data Type (ADT) |
---|---|---|
Standard data types that comes built-in with a programming language, from which other data types are composed is known as primitive data type. | Data type created from collection of primitive and/or other composite type is referred as composite data type. | ADT does not define a concrete representation of data. Rather it specifies the operation performed on the data type. |
Defined by the programming language. | Defined by the programmer. | Specification is given, implementation may be given by programming language. |
Also known as built-in or standard data type. | Also known as user-defined or composite data type. | |
Atomic in nature, stored data cannot be further broken down and accessed individually. | Non-atomic in nature, stored data can be accessed individually. | Does not define concrete data. |
Must have a concrete value. | Can have null values. | Does not define concrete data. |
Defines concrete data in memory. | User can define both concrete data and methods to operate on data. | Specifies methods to operate on the data. |
Example: int , float , boolean , char | Example: struct , class etc. | Example: List , Stack , Queue etc. |