CERN Accelerating science

This website is no longer maintained. Its content may be obsolete. Please visit for current CERN information.

next up previous
Next: X-Window Resources Specification Up: Fortran 90 Tutorial: Previous: Arrays of pointers

Pointers as dynamic aliases

Given an array

     REAL, TARGET :: table(100,100)
that is frequently referenced with the fixed subscripts

     table(m:n, p:q)
these references may be replaced by

     REAL, DIMENSION(:, :), POINTER :: window
     window => table(m:n, p:q)
The subscripts of window are 1:n-m+1, 1:q-p+1. Similarly, for

(as defined in Part 7: ``Array Handling II'', CNL213, page 23), we can use, say,

           taru => tar%u
to point at all the u components of tar, and subscript it as

           taru(1, 2)
The subscripts are as those of tar itself. (This replaces yet more of EQUIVALENCE.)

The source code of an extended example of the use of pointers to support a data structure can be obtained by anonymous ftp to ( The directory is /pub/MandR and the file name is appxg.f90.

In the next article we shall have a more complete look at specification statements.

Janne Saarela
Tue May 16 13:43:26 METDST 1995