The following table describes the inquiry functions −
|Sr.No||Function & Description|
It is a logical function which indicates if the array is allocated.
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.
It returns the shape of an array source as an integer vector.
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.
It returns the upper dimensional limits.
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