# Fortran - Inquiry Functions

#### Complete Python Prime Pack

9 Courses     2 eBooks

#### Artificial Intelligence & Machine Learning Prime Pack

6 Courses     1 eBooks

#### Java Prime Pack

9 Courses     2 eBooks

The following table describes the inquiry functions −

Sr.No Function & Description
1

allocated(array)

It is a logical function which indicates if the array is allocated.

2

lbound(array, dim)

It returns the lower dimension limit for the array. If dim (the dimension) is not given as an argument, you get an integer vector, if dim is included, you get the integer value with exactly that lower dimension limit, for which you asked.

3

shape(source)

It returns the shape of an array source as an integer vector.

4

size(array, dim)

It returns the number of elements in an array. If dim is not given, and the number of elements in the relevant dimension if dim is included.

5

ubound(array, dim)

It returns the upper dimensional limits.

## Example

The following example demonstrates the concept −

```program arrayInquiry

real, dimension(3,2) :: a
a = reshape( (/5,9,6,10,8,12/), (/3,2/) )

Print *, lbound(a, dim = 1)
Print *, ubound(a, dim = 1)
Print *, shape(a)
Print *, size(a,dim = 1)

end program arrayInquiry
```

When the above code is compiled and executed, it produces the following result −

```1
3
3 2
3
```
fortran_arrays.htm