Fortran 90 Differences in Distributed Array Declaration

Is there a difference between

integer, intent(in) :: n
integer, dimension(:), allocatable :: a
allocate(a(n))

and

integer, intent(in) :: n
integer, dimension(n) :: a

In what situation will we use the first version? Perhaps I misunderstood the allocatable array, is the second version even a allocated array?

+4
source share
2 answers

The second case really does not have aallocatable. This, however, is an automatic object.

, . , a ( , ) , allocate n, . , (, ) . .

( ) .

+6

- . .

- , . , , , .

+1

Source: https://habr.com/ru/post/1545447/


All Articles