Data type
From Free net encyclopedia
Data type is a type of data in a type system in computer programming. Types of data in programming languages include primitive types, such as integers, floating point numbers or characters, tuples, records, algebraic data types, abstract data types, reference types, classes, and nodes of data structures. A data type describes representation, interpretation and structure of values manipulated by algorithms or objects stored in computer memory or other storage device. The type system uses data type information to check correctness of computer programs that access or manipulate the data.
Contents |
Machine data types
All data in computers based on digital electronics is represented as bits (alternatives 0 and 1) on the lowest level. The smallest addressable unit of data is a group of bits called a byte (usually an octet, which is 8 bits). The unit processed by machine code instructions is called a word (as of 2006, typically 32 or 64 bits). Most instructions interpret the word as a binary number, such that a 32-bit word can represent unsigned integer values from 0 to <math>2^{32}-1</math> or signed integer values from <math>-2^{31}</math> to <math>2^{31}-1</math>. Because of two's complement, the machine language and machine don't need to distinguish between these unsigned and signed data types for the most part.
There is specific set of arithmetic instructions that use a different interpretation of the bits in word as a floating-point number.
Primitive data types
Template:Main Programming languages provide some primitive data types as basic building blocks for programs and more specialized composite types. Typically primitive data types include various integer, floating-point and string types. Although basic building blocks, arrays, records and references for relations between pieces of data might not be included in primitive data types as they can be seen the collection of several primitive values.
Number types
Composite types
Data structures
Abstract types
See also
- Type theory for the mathematical models of types
- Type system for different choices in programming language typing
References
- Luca Cardelli, Peter Wegner. On Understanding Types, Data Abstraction, and Polymorphism, [1] from Computing Surveys, (December, 1985)
Template:Comp-sci-stubast:Tipu de datu cs:Datový typ de:Datentyp es:Tipo de dato fr:Type hu:Adattípus it:Tipo di dato ja:データ型 lt:Duomenų struktūra nl:Gegevenstype pl:Dynamiczne typowanie pt:Tipo de dado ru:Тип данных ru:Тип переменной sl:Podatkovni tip sv:Datatyp ta:தரவு இனம்