Main Page | See live article | Alphabetical index

Composite type

This article should be merged with composition.

In computer science, a composite type, the opposite to a primitive type, is a datatype made up of more primitive types. The type is the most foundmental type besides primitive, supported by the vast majority of programming languages and is used heavily.

The type is typically used to form a type of valuess representing attributes of particular object. Attributes are mostly given some name to allow accessing to it. It is common to combine composite types to make a new composite type.

Values with a composite type are stored in the memory in such a way that each attribute is followed by another attribute. If the type consists of other composite types, such composite type is expanded recursively. An alignment of each is often on issue because

Example

This is a composite type of struct in C.

struct Person {
 int age;
 enum { male, female };
};