On Fri, 5 Jan 2001, Mingwu Bai wrote:
> 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)
Use allocatable arrays. Something like
real, allocatable :: AA(:)
read (*,*) N
allocate (AA(N))
You can add a stat=status clause to check for successful allocation
where status is an integer. It is a compiler dependent positive number
if the allocation process fails, otherwise it is 0.
I suggest to read a text book on F90/95.
Joerg
--
http://www.warwick.ac.uk/staff/J.Strutwolf/
|