Next: Deallocating Arrays
Up: Arrays
Previous: Array Constructors in Initialisation
Fortran 90 allows arrays to be created on-the-fly; these are known as
deferred-shape arrays and use dynamic heap storage.
Deferred-shape arrays are:
- declared like
explicit-shape arrays but without the extents and with the ALLOCATABLE
attribute:
INTEGER, DIMENSION(:), ALLOCATABLE :: ages
REAL, DIMENSION(:,:), ALLOCATABLE :: speed
- given a size in an ALLOCATE statement which assigns an
area of memory to the object:
ALLOCATE(ages(1:10), STAT=ierr)
ALLOCATE(speed(-lwb:upb,-50:0),STAT=ierr)
- the optional STAT= field reports on the success of the
storage request. If the INTEGER variable ierr is zero the request was
successful otherwise it failed.
For more information, click here
Next: Deallocating Arrays
Up: Arrays
Previous: Array Constructors in Initialisation
Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 18:56:08 GMT 1996Not for commercial use.