This article needs additional citations for verification. (September 2021) |
In computer science, a record (also called a structure, struct, or compound data type) is a composite data structure – a collection of fields, possibly of different data types, typically fixed in number and sequence.[1]
For example, a date could be stored as a record containing a numeric year field, a month field represented as a string, and a numeric day-of-month field. A circle record might contain a numeric radius and a center that is a point record containing x and y coordinates.
Notable applications include the programming language record type and for row-based storage, data organized as a sequence of records, such as a database table, spreadsheet or comma-separated values (CSV) file. In general, a record type value is stored in memory and row-based storage is in mass storage.
A record type is a data type that describes such values and variables. Most modern programming languages allow the programmer to define new record types. The definition includes specifying the data type of each field and an identifier (name or label) by which it can be accessed. In type theory, product types (with no field names) are generally preferred due to their simplicity, but proper record types are studied in languages such as System F-sub. Since type-theoretical records may contain first-class function-typed fields in addition to data, they can express many features of object-oriented programming.