LF Fortran 95

LBOUND Function


The LBOUND function returns the lower bounds of a whole array or a particular dimension of an array.


LBOUND (array [, dim])

Required Arguments

array is an INTENT(IN) array of any type.

It must not be a pointer that is disassociated or an allocatable array that is not allocated.

Optional Arguments

dim is an INTENT(IN) scalar of type INTEGER, with a value that is less than or equal to the rank of array.


The result is of type default INTEGER.

If dim is present, the result is a scalar with the value of the lower bound of dim.

If dim is absent, the result is an array of rank one with values corresponding to the lower bounds of each dimension of array.

The lower bound of an array section is always one. The lower bound of a zero-sized dimension is also always one.


integer :: j(10),i(0:10,-1:10,-2:10,-3:10) write(*,*) lbound(j) ! writes 1 write(*,*) lbound(i) ! writes 0 -1 -2 -3 write(*,*) lbound(i,2) ! writes -1 write(*,*) lbound(i,4) ! writes -3

See Also

UBOUND Function