SIZE — Determine the size of an array#
-
SIZE(ARRAY, DIM, KIND)#
Determine the extent of
ARRAYalong a specified dimensionDIM, or the total number of elements inARRAYifDIMis absent.- Parameters
ARRAY – Shall be an array of any type. If
ARRAYis a pointer it must be associated and allocatable arrays must be allocated.DIM – (Optional) shall be a scalar of type
INTEGERand its value shall be in the range from 1 to n, where n equals the rank ofARRAY.KIND – (Optional) An
INTEGERinitialization expression indicating the kind parameter of the result.
- Returns
The return value is of type
INTEGERand of kindKIND. IfKINDis absent, the return value is of default integer kind.
- Standard:
Fortran 90 and later, with
KINDargument Fortran 2003 and later- Class:
Inquiry function
- Syntax:
RESULT = SIZE(ARRAY[, DIM [, KIND]])
- Example:
PROGRAM test_size WRITE(*,*) SIZE((/ 1, 2 /)) ! 2 END PROGRAM
- See also:
SHAPE — Determine the shape of an array, RESHAPE — Function to reshape an array