2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
6 .. index:: UBOUND, array, upper bound
10 UBOUND --- Upper dimension bounds of an array
11 *********************************************
13 .. function:: UBOUND(ARRAY , DIM , KIND)
15 Returns the upper bounds of an array, or a single upper bound
16 along the :samp:`{DIM}` dimension.
19 Shall be an array, of any type.
22 (Optional) Shall be a scalar ``INTEGER``.
25 (Optional) An ``INTEGER`` initialization
26 expression indicating the kind parameter of the result.
29 The return value is of type ``INTEGER`` and of kind :samp:`{KIND}`. If
30 :samp:`{KIND}` is absent, the return value is of default integer kind.
31 If :samp:`{DIM}` is absent, the result is an array of the upper bounds of
32 :samp:`{ARRAY}`. If :samp:`{DIM}` is present, the result is a scalar
33 corresponding to the upper bound of the array along that dimension. If
34 :samp:`{ARRAY}` is an expression rather than a whole array or array
35 structure component, or if it has a zero extent along the relevant
36 dimension, the upper bound is taken to be the number of elements along
37 the relevant dimension.
40 Fortran 90 and later, with :samp:`{KIND}` argument Fortran 2003 and later
46 .. code-block:: fortran
48 RESULT = UBOUND(ARRAY [, DIM [, KIND]])