Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.fortran Subject: Re: Dimensioning arrays at run-time, best way? Message-ID: <3798@goanna.cs.rmit.oz.au> Date: 21 Sep 90 08:20:04 GMT References: <614@keele.keele.ac.uk> <1990Sep17.150155.10220@alchemy.chem.utoronto.ca> Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 30 In article <614@keele.keele.ac.uk> phd11@.uk.ac.keele (Zipzoid) asked: > I think this question may have been asked many times before, > but what is the best way of dimensioning an array whose maximum > memory requirement (size) would be read in at run-time? In article <1990Sep17.150155.10220@alchemy.chem.utoronto.ca>, mroussel@alchemy.chem.utoronto.ca (Marc Roussel) suggested: > PROGRAM EXAMPLE > read(*,*)n > call sub1(n) > END > SUBROUTINE SUB1(N,X) > real X(N) > C Do the work in this subroutine. > C Of course you can't use common blocks so you'll have to pass X > C around as an argument. > END > Good luck! My word we'll _need_ it! What, precisely, is X supposed to be? Yes, I know that this was deliberate. What when you arrive in SUB1, what do you expect X to be? On one machine here, when I use f77 X seems to be the address 0 (which happens to "work"), while when I use f2c followed by gcc I get a completely different address. -- Heuer's Law: Any feature is a bug unless it can be turned off.