In computer programming, a data type is a classification of data that specifies which type of value a variable has and what type of operations (mathematical, logical, relational) can be applied to it without causing an error. Generally, in all programming language, we have a limited set of such data types, for example, integers, floats, string, character and boolean. The range of values that can be stored in each of these data types is defined by the language and the computer hardware.
A Data type provides a set of values from which an expression (i.e. variable, function ...) may take its values. The data type defines the operations that can be done on the data and the way values of that data type can be stored.
These data types are derived from primary data types are used to store the group of values. They are normally built by the combination of primary or built-in data types and associated operations on them.
For example, integers are an abstract data type, defined as the values …, −2, −1, 0, 1, 2, …, and by the operations of addition, subtraction, multiplication, and division, together with greater than, less than, etc., which behave according to familiar mathematics (with care for integer division), independently of how the integers are represented by the computer.
A Data type provides a set of values from which an expression (i.e. variable, function ...) may take its values. The data type defines the operations that can be done on the data and the way values of that data type can be stored.
Primitive Data Types (Built-in data types)
Those data types for which a language has built-in support are known as Primitive or Built-in Data types. These are predefined types of data, which are supported by the programming language. For example, most of the languages provide the following built-in data types.
- Integers
- Boolean (true, false)
- Floating (Decimal numbers)
- Character and Strings
Primitive data types are only single values, they do not have any special capabilities. They are normally operated directly upon the machine by the machine level instructions.
User-Defined Data Types (Derived Data Types)
Those data types that are not defined by the programming language but are instead created by the programmer are known as User-defined or Non-primitive or Derived Data types. They are sometimes called "reference variables" since they reference a memory location, which stores the data. For example
Those data types that are not defined by the programming language but are instead created by the programmer are known as User-defined or Non-primitive or Derived Data types. They are sometimes called "reference variables" since they reference a memory location, which stores the data. For example
- List
- Array
- Stack
- Queue
Abstract Data Type
An abstract data type (ADT) is basically a logical description or a specification of components of the data and the operations that are allowed, that is independent of the implementation. There are no standard conventions for defining them. An abstract data type is a type with associated operations, but whose representation is hidden.
An abstract data type (ADT) is basically a logical description or a specification of components of the data and the operations that are allowed, that is independent of the implementation. There are no standard conventions for defining them. An abstract data type is a type with associated operations, but whose representation is hidden.
Why use Abstract data type?
To manage the complexity of problems and the problem-solving process, abstractions are used to allow the user to focus on the “big picture” without getting lost in the details. By creating models of the problem domain, the user can efficiently focus on the problem-solving process.
No comments:
Post a Comment