In the Pascal programming language, the date
42 has the data type
- The data type
integerhas a certain range of allowed values. For example on an 8-bit computer, this range includes all whole numbers between
127. The value
1337, however, is not an allowed
- Furthermore, the data type
integerallows certain operations: The operation
+can take two
integerdates and calculates their combined sum. There are many more operations. All those operations characterize the data type
A data type forms a unit:
Together, the specific permissible range and legal operations, are referred to as a concrete data type.
When a programmer or the compiler read the word
integer in the source code, they automatically understand which values and operations are allowed.
Data types are an abstract concept. This concept primarily appears in high-level programming languages. Virtually all high-level programming language explicitly include the notion of data type. Common basic data types may include:
Usually, these and other basic data types can be combined to custom data types using structure concepts like:
The notion of data type as presented above is unknown in assembly language, a low-level programming language. All computers know integer number values. Modern computers also know real numbers in binary. But there is no rigid enforcement of proper “data type” use. Assembly language does not prevent using an integer as if it was a real number. This is intentional, because assembly language is the basis of all (high-level) programming languages.
Yet, the processor’s machine code sets the limits. Usually, the only “data types” are:
- register names
- memory addresses
- immediate values
All of which may be further differentiated by their size, how many Bytes each of those occupy, or—in the case of memory address—how many Bytes the referenced object occupies.
- "What is a Data Type?". www.computerhope.com. Retrieved 2019-05-23.