Software Archive
Read-only legacy content
17060 Discussions

How to define temporary arryas at execution time?

WSinc
New Contributor I
313 Views
I want to set up something like the NEW statement in C++, where I don't want to allocate permanent storage, but only according to the size of the problem at execution time.

Does Fortran allow me to define an array that does not exist at compilation time, where the size can be defined by user input?

Even in some versions of C++ the user has to commit himself at compilation time regarding the sizes of arrays.
0 Kudos
1 Reply
Steven_L_Intel1
Employee
313 Views
Yes. Look at ALLOCATABLE arrays. If an ALLOCATABLE array is a local variable in a routine, and not given the SAVE attribute, it gets automatically deallocated on routine exit.

Steve
0 Kudos
Reply