The SIZE function returns the size of an array or a dimension of an array.
SyntaxSIZE (array [, dim] )
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.
dim is an INTENT(IN) scalar of type INTEGER and must be a dimension of array. If array is assumed-size, dim must be present and less than the rank of array
The result is a scalar default INTEGER.
If dim is present, the result is the extent of dimension dim of array.
If dim is absent, the result is the total number of elements in array.
Exampleinteger,dimension(3,-4:0) :: i integer :: k,j write(*,*) size (i) ! writes 15 write(*,*) size (i,2) ! writes 5