Home > Primitive type
In computer science, primitive types, as distinct from composite types - are datatypes 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 not implemented as a primitive datatype, whereas in modern dialects of Basic they are primitives.
Typical primitive types include:
- character (
character, char);
- Integer (
integer, int, short, long) with a variety of precisions;
- floating-point number (
float, double, real, double precision) with binary representation usually conforming to the IEEE standards for floating point representation;
- Fixed-point (
fixed) with a variety of precisions and a programmer-selected scale.
- boolean having the values true and false.
- string (
string), a sequence of characters, which can be of zero length – containing no characters – if desired);
- referenceThis article discusses a general notion of reference in computing. See also the more specific notion of reference used in C++. In computer science, a reference is a small object containing information which refers to data elsewhere, as opposed to containi (also called a " pointerThis article is about the computer data type. For other meanings of pointer see pointer (disambiguation). In computer science, a pointer is a programming language datatype whose value is used to refer to ("points to") another value stored elsewhere in the" or "handle"), a small value referring to another object, possibly a much larger one.
More sophisticated types include:
- Tuples in MLML is a general-purpose functional programming language developed by Robin Milner and others in the late 1970s at Edinburgh University, whose syntax is inspired by ISWIM. Historically, ML stands for metalanguage as it was conceived to develop proof tactic
- Linked listIn computer science, a linked list is one of the fundamental data structures used in computer programming. It consists of a sequence of nodes, each containing arbitrary data fields and one or two references ("links") pointing to the next and/or previous ns in LispLisp is a family of functional programming languages with a long history. Developed first as an abstract notation for recursive functions, it later became the favored language of artificial intelligence research during the field's heyday in the 1970s and
- complex numberThe complex numbers are an extension of the real numbers, in which all non-constant polynomials have roots. The complex numbers contain a number , the imaginary unit with , i. is a square root of. Every complex number can be represented in the form , whers in Fortran, C++, C (C99)
- rational numbers in Lisp
- first class functions, closures, continuations in Functional programming languages such as Lisp and ML
Operations on primitive types are often the fastest language contructs there are. Integer addition, for example, can be performed as a single machine instruction, and some processors offer specific instructions to process sequences of characters with a single instruction.
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.
Computer science
Programming