LBOUND

Platform

x64, Win32, .NET

Purpose

To return all the lower bounds or a specified lower bound of an array.

Class

Inquiry function.

Syntax

INTEGER FUNCTION LBOUND(ARRAY [, DIM [, KIND]])
INTEGER DIM, KIND

Description

ARRAY is an array of any type, not a scalar. If it is a pointer it must be associated. If it is an allocatable array it must be allocated. DIM (optional) is a scalar integer with a value in the range 1 < DIM < n, where n is the rank of ARRAY.

The result is of default integer type. It is scalar if DIM is present; otherwise, the result is an array of rank one and size n, where n is the rank of ARRAY. If KIND is present it provides the INTEGER kind value of the result.

Return value

  1. For an array section or for an array expression other than a whole array or array structure component, LBOUND(ARRAY, DIM) has the value 1. For a whole array or array structure component, LBOUND(ARRAY, DIM) has the value:

    1. equal to the lower bound for subscript DIM of ARRAY if dimension DIM of ARRAY does not have extent zero or if ARRAY is an assumed-size array of rank DIM, or

    2. 1 otherwise.

  2. LBOUND(ARRAY) has a value whose ith component is equal to LBOUND(ARRAY, i), for i = 1, 2, ..., n, where n is the rank of ARRAY.

Notes

LBOUND returns a value of default integer type on all platforms. For x64 this will be 32 bits by default.

Example

If A is declared by the statement

REAL A(2:3,7:10)

then LBOUND(A) is [2, 7] and LBOUND(A, DIM=2) is 7.

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited