These intrinsics allow the user to quiz arrays about their attributes and status and are most often applied to dummy arguments in procedures. Consider the declaration:
REAL, DIMENSION(-10:10,23,14:28) :: A
the following inquiry intrinsics are available,
Returns a one dimensional array containing the lower bounds of an array or, if a dimension is specified, a scalar containing the lower bound in that dimension. For example,
Returns a one dimensional array containing the upper bounds of an array or, if a dimension is specified, a scalar containing the upper bound in that dimension. For example,
Returns a one dimensional array containing the shape of an object. For example,
Returns a scalar containing the total number of array elements either in the whole array or in an optionally specified dimension. For example,
Returns a scalar LOGICAL result indicating whether an array is allocated or not. For example,
PROGRAM Main IMPLICIT NONE INTEGER, ALLOCATABLE, DIMENSION(:) :: Vec PRINT*, ALLOCATED(Vec) ALLOCATE(Vec(10)) PRINT*, ALLOCATED(Vec) DEALLOCATE(Vec) PRINT*, ALLOCATED(Vec) END PROGRAM Main
will produce .FALSE., .TRUE. and .FALSE. in that order.
Return to corresponding overview page