[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.14 array

Synopsis

In type definitions:
 
array [index type] of element type
or
 
array [index type, ..., index type] of element type

In parameter list declarations:
 
array of element type

Description

The reserved word `array' is used to define an array type.

@@!!!! arrays in parameter lists

Conforming to

Array types are defined in ISO 7185 Pascal.

Example

 
program ArrayDemo;
type
  IntArray = array [1 .. 20] of Integer;
  WeekDayChars = array [(Mon, Tue, Wed, Thu, Fri, Sat, Sun)] of Char;
  Foo = array [0 .. 9, 'a' .. 'z', (Baz, Glork1, Fred)] of Real;
  TwoDimIntArray = array [1 .. 10] of IntArray;
  { is equivalent to: }
  TwoDimIntArray2 = array [1 .. 10, 1 .. 20] of Integer;

procedure PrintChars (F: array of Char); var i: Integer; begin for i := Low (F) to High (F) do WriteLn (F[i]) end;

var Waldo: WeekDayChars;

begin Waldo := 'HiWorld'; PrintChars (Waldo) end.

See also

section 8.2.10.3 Array Types, section 9.109 High, section 9.147 Low



This document was generated by Frank Heckenbach on May, 10 2002 using texi2html