Record Types

  • Niklaus Wirth
Part of the Text and Monographs in Computer Science book series (MCS)

Abstract

In an array all elements are of the same type. In contrast to the array, the record structure offers the possibility to declare a collection of elements as a unit even if the elements are of different types. The following examples are typical cases where the record is the appropriate choice of structuring method. A date consists of three elements, namely day, month, and year. A description of a person may consist of the person’s names, sex, identification number, and birthdate. This is expressed by the following type declarations

Date = RECORD day: [1.. 31];

mo: month;

yr: INTEGER

END

Person = RECORD

firstName, lastName: ARRAY [0.. 31] OF CHAR;

male: BOOLEAN;

idno: INTEGER;

birth: Date

END

Keywords

Prefix 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Springer-Verlag Berlin Heidelberg 1988

Authors and Affiliations

  • Niklaus Wirth
    • 1
  1. 1.Institut für InformatikETHZürichSwitzerland

Personalised recommendations