SIZE (The GNU Fortran Compiler)

### 8.263 `SIZE` — Determine the size of an array ¶

Synopsis:

  `RESULT = SIZE(ARRAY[, DIM [, KIND]])`

Description:

  Determine the extent of ARRAY along a specified dimension DIM, or the total number of elements in ARRAY if DIM is absent.

Class:

  Inquiry function

Arguments:

  ARRAY | Shall be an array of any type. If ARRAY is a pointer it must be associated and allocatable arrays must be allocated.
  DIM | (Optional) shall be a scalar of type `INTEGER` and its value shall be in the range from 1 to n, where n equals the rank of ARRAY.
  KIND | (Optional) A scalar `INTEGER` constant expression indicating the kind parameter of the result.

Return value:

  The return value is of type `INTEGER` and of kind KIND. If KIND is absent, the return value is of default integer kind.

Example:

      PROGRAM test_size
        WRITE(*,*) SIZE((/ 1, 2 /))    ! 2
      END PROGRAM

Standard:

  Fortran 90 and later, with KIND argument Fortran 2003 and later

See also:

  `SHAPE` — Determine the shape of an array,
  `RESHAPE` — Function to reshape an array