XL Fortran for AIX 8.1

Language Reference


SIZE(ARRAY, DIM)

Returns the extent of an array along a specified dimension or the total number of elements in the array.

ARRAY
is an array of any data type. It must not be a scalar, disassociated pointer, or allocatable array that is not allocated. It can be an assumed-size array if DIM is present and has a value that is less than the rank of ARRAY.

DIM (optional)
is an integer scalar in the range 1 <= DIM <= rank(ARRAY).

Class

Inquiry function

Result Type and Attributes

Default integer scalar.

Result Value

The result equals the extent of ARRAY along dimension DIM; or, if DIM is not specified, it is the total number of array elements in ARRAY.

Examples

! A is the array  | 1 -4  7 -10 |
!                 | 2  5 -8  11 |
!                 | 3  6  9 -12 |
 
       RES = SIZE( A )
! The result is 12 because there are 12 elements in A.
 
       RES = SIZE( A, DIM = 1)
! The result is 3 because there are 3 rows in A.
 
       RES = SIZE( A, DIM = 2)
! The result is 4 because there are 4 columns in A.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]