Next: UCOBOUND, Previous: TTYNAM, Up: Intrinsic Procedures

### 8.251 `UBOUND` — Upper dimension bounds of an array

Description:
  Returns the upper bounds of an array, or a single upper bound along the DIM dimension.
Standard:
  Fortran 95 and later, with KIND argument Fortran 2003 and later
Class:
  Inquiry function
Syntax:
  `RESULT = UBOUND(ARRAY [, DIM [, KIND]])`
Arguments:

  ARRAY | Shall be an array, of any type.
  DIM | (Optional) Shall be a scalar `INTEGER`.
  KIND | (Optional) An `INTEGER` initialization 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. If DIM is absent, the result is an array of the upper bounds of ARRAY. If DIM is present, the result is a scalar corresponding to the upper bound of the array along that dimension. If ARRAY is an expression rather than a whole array or array structure component, or if it has a zero extent along the relevant dimension, the upper bound is taken to be the number of elements along the relevant dimension.
See also:
  LBOUND, LCOBOUND