- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is it possible to allocate an array inside a subroutine? And after use that array in my main program?
Would somebody help me out with it?
Thanks,
Vincius Reis
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If I wanted to do this, I would try defining the array as ALLOCATABLE In a module which I include in the main program and the subroutine. I would then ALLOCATE it in the subroutine and, before attempting to use it in the main program, test to see if it has been ALLOCATED or not. I do not know if the above will work, but there is no harm in trying it. Make sure you have some method of keeping track of it and DEALLOCATE it when not needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using module works fine; I use this extensively to manage space in my stat package.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tank you very much. I'm a little unexperienced!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page