Hi!
Is it possible to define arrays of variable length?
I explain better:
an array whose length is unknown because it will be "filled" if a
certain condition is satisfied. Below is an example (does not work):
Thank you,
celevic
PROGRAM proof_array
implicit none
integer :: i,j,n
integer,allocatable :: A(:)
integer, dimension(10) :: B=(/(i, i=1,10,1)/)
n=0
do j=1,10,1
if (j<6) then
A(j)=j
n=n+1
endif
enddo
allocate(A(1:n))
write(*,100) A
100 format (I)
END PROGRAM
|