Primitive type
Encyclopedia : P : PR : PRI : Primitive type
In computer science, primitive types — as distinct from composite types — are data types provided by a programming language as basic building blocks. Depending on the language and its implementation, primitive types may or may not have a one-to-one correspondence with objects in the computer's memory.
Primitive types are also known as built-in types or basic types.
The actual range of primitive types that is available is dependent upon the specific programming language that is being used. For example, in C, strings are a composite data type, whereas in modern dialects of Basic they are a primitive data type.
Typical primitive types may include:
- character (
character,char); - Integer (
integer,int,short,long) with a variety of precisions; - floating-point number (
float,double,real,double precision); - Fixed-point (
fixed) with a variety of precisions and a programmer-selected scale. - boolean having the values true and false.
- datatype (
string), a sequence of characters, which can be of zero length – containing no characters – if desired); - reference (also called a pointer or handle), a small value referring to another object's address in memory, possibly a much larger one.
- Tuples in ML
- Linked lists in Lisp
- complex numbers in Fortran, C (C99), Python
- rational numbers in Lisp
- first class functions, closures, continuations in Functional programming languages such as Lisp and ML
int is likely to be 32 bits long on a 32-bit
architecture.Most languages do not allow the behaviour or capabilities of primitive types to be modified by programs. Exceptions include Smalltalk, which permits primitive datatypes to be extended within a program, adding to the operations that can be performed on them or even redefining the built-in operations.
From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.
