size(x): Size of Array

Returns the size of an array x.

Declaration

Sintaxe

retval = size(A[, dim[, kind]])
integer function size(x)

Argumentos

A the input array of any type or rank.

dim optional dimension, if present, size returns the size of this dimension.

kind optional the kind of the return value.

Valores de retorno

n the size of an array (integer).

Descrição

The size intrinsic function returns the size of an array. It returns the product of all dimensions, unless the dim argument is specified, in which case it only returns the size of this particular dimension. The kind argument can be used to specify the integer kind of the result.

Tipos

Supported argument type is integer.

Exemplos

program intrinsics_size
    implicit none
    real :: A(3, 4)
    print *, size(A)
    print *, size(A, 2)
end program

Resultado:

12
4

Veja Também

shape, reshape.