Contents | Prev | Next | Index
An array is a structure consisting of a number of elements that are all of the same type, called the element type or component type. The number of elements of an array type is called its length. The length is determined by the specification of an index type. The array type declaration specifies both the component type and the index type. The latter must be an enumeration, a subrange type, or one of the non-real basic types. The elements of the array are designated by indices, values belonging to the index type. It is also possible to specify multiple indexes in a comma separated list for multi-dimensional arrays.
array_type ::= ARRAY [ index_type_list ] OF
type index_type_list ::= index_type_list , index_type ::= index_type index_type ::= simple_type |
A type of the form:
ARRAY [T0,T1,...,Tn] OF T
is understood as an abbreviation of
ARRAY [T0] OF
ARRAY [T1] OF
...
ARRAY [Tn] OF T
An array type of the form
ARRAY [0..n] OF CHAR
where n is a positive nonzero integer constant is called a zero-based character array. They may be used for storing zero-terminated strings.
This Pascal compiler also allows arrays without the index specifier. These are called open arrays. They are restricted to base types of pointer types and to formal parameter types. If they are used for pointer types, the language extensions must be enabled via a compiler switch or directive.
formal_type ::= qualident ::= open_array qualident pointer_type ::= ^ pointee_type ::= ^ open_array pointee_type open_array ::= ARRAY OF pointee_type ::= qualident |
Contents | Prev | Next | Index
Canterbury Pascal for JVM (Last documentation update
Sep 02, 2004)
Copyright © 1999-2004 J.Neuhoff - mhccorp.com
. All rights reserved.
Please send any comments or corrections to
neuhoff@mhccorp.com