Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!noao!ncar!elroy.jpl.nasa.gov!decwrl!mcnc!ecsgate!ecsvax!uncw!session From: session@uncw.UUCP (Zack C. Sessions) Newsgroups: comp.lang.fortran Subject: Re: Read dimension Message-ID: <1022@uncw.UUCP> Date: 26 Feb 91 18:42:28 GMT References: <61477@eerie.acsu.Buffalo.EDU> <1012@uncw.UUCP> Organization: Univ. of North Carolina at Wilmington Lines: 39 u714092@mustang.larc.nasa.gov (prichard devon ) writes: >In article <1012@uncw.UUCP> session@uncw.UUCP (Zack C. Sessions) writes: > xiaofei@acsu.buffalo.edu (Xiaofei Wang) writes: > >main program > >parameter(m=10,n=5) > >real a(m,n) > >call subroutine(a,b) > >end > >I don't want to put m=10 n=5 to the program, I would like to > >read into the program. so that I don't have to change program > >every time. However a(m,n) has to be defined before read. > >-- > I am most familiar with VAX FORTRAN, but I think this applies to >one of the computer gurus suggested to me to write the brunt of the >code in Fortran, but the main routine in C. the C function dynamically >allocates the array in the Fortran subroutine argument list, at which >point its straight Fortran processing. >I haven't tried this yet, but it oughta work. its definitely the simplest >method for dynamic array allocation I've seen. of course, there may be >funny memory conflicts due to linking Fortran and C code... Hmm, wonder why you didn't include anything from MY posting, even though there was a header line in there? Anyway, as someone mentioned, some programmers don't have the luxury of having both a FORTRAN compiler and a C compiler. While it is obviously the most efficient way to tackle the problem given that the only thing you want to do in C is the dynamic memory allocation. But IMHO, if your going to do that much of it in C, may as well do the whole thing in C!! Zack Sessions ...!ecsvax!uncw!session