In Fortran 90 you need to make the array allocatable: Something like
real, allocatable :: AA(:)
read (*,*) N
allocate (AA(N))
AA acts like an ordinary array, but the allocate statement gets memory
from the system at run-time. Naturally, you can't use AA before you
execute the allocate statement. You can't allocate a dummy argument in
a subroutine; the allocation must be done where the array is first
declared, or the array can be in a module. The example above should
work
for almost anything; if you need to do something more complicated a
good Fortran 90 book should have some more examples.
Dick Hendrickson
Mingwu Bai wrote:
>
> Hi, Sir,
> How to program so that the dimension of an array is a variant (the value
> will be given before run the program, see following))?
>
> Thanks.
>
> read (*,*) N
> Dimension AA(N)
> ...
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
|