# UCOBOUND

Inquiry Intrinsic Function (Generic): Returns the upper cobounds of a coarray.

result = UCOBOUND (coarray [,dim [, kind])

coarray | (Input) Must be a coarray; it can be of any type. It can be a scalar or an array. If it is allocatable, it must be allocated.
dim | (Input; optional) Must be an integer scalar with a value in the range 1 <= dim <= n, where n is the corank of coarray. The corresponding actual argument must not be an optional dummy argument.
kind | (Input; optional) Must be a scalar integer constant expression.

## Results

The result type is integer. If kind is present, the kind parameter is that specified by kind; otherwise, the kind parameter is that of default integer type. The result is scalar if dim is present; otherwise, the result is an array of rank one and size n, wheren is the corank of coarray.

The final upper cobound is the final cosubscript in the cosubscript list for the coarray that selects the image whose index is equal to the number of images in the current team. The result depends on whether dim is specified:

- If dim is specified, UCOBOUND (COARRAY, DIM) has a value equal to the upper cobound for cosubscript dim of coarray.

- If dim is not specified, UCOBOUND (COARRAY) has a value whose ith element is equal to UCOBOUND (COARRAY, i), for i = 1, 2,. . . , n, where n is the corank of coarray.

## Examples

If A is allocated by the statement ALLOCATE (A [2:3, 7:*]), then LCOBOUND (A) is [2, 7] and LCOBOUND (A, DIM=2) is 7.

If NUM_IMAGES( ) has the value 30, and coarray B is allocated by the statement ALLOCATE (B[2:3, 0:7, *]), then UCOBOUND (B) is [3, 7, 2] and UCOBOUND (B, DIM=2) is 7. Note that the cosubscripts [3, 7, 2] do not correspond to an actual image.

Parent topic: T to Z