Contents    Page-10    Prev    Next    Page+10    Index   

Array References in Pascal

Pascal uses row-major order, making array declarations and references easy to process.

For array declarations,
         array[i..j,k..l] of type
is equivalent to:
         array[i..j] of array[k..l] of type
These declarations are reduced starting at the right, so that each reduction is of the form:
         array[...] of type
where type has been completely processed and has a known size.

For array references,
is equivalent to:
These references are processed left-to-right, so that a[i] is done first, yielding code for a[i] and a type that is an array type; then [j] is processed relative to that array type.

Using these conventions, arrays with multiple dimensions are handled in the same way as singly-dimensioned arrays.