RANK - The GNU Fortran Compiler
Description: The GNU Fortran Compiler

Next: REAL, Previous: RANGE, Up: Intrinsic Procedures

### 8.203 `RANK` — Rank of a data object

Description:
  `RANK(A)` returns the rank of a scalar or array data object.
Standard:
  Technical Specification (TS) 29113
Class:
  Inquiry function
Syntax:
  `RESULT = RANGE(A)`
Arguments:

  A | can be of any type

Return value:
  The return value is of type `INTEGER` and of the default integer kind. For arrays, their rank is returned; for scalars zero is returned.
Example:

                program test_rank
                  integer :: a
                  real, allocatable :: b(:,:)

                  print *, rank(a), rank(b) ! Prints:  0  3
                end program test_rank