LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-14-2005, 04:45 PM   #1
halfpower
Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 244

Rep: Reputation: 31
Dynamically set array length in Fortran77?


Is it possible to dynamically set the size of an array in Fortran 77? For example a code like the one below, but written in such a way that it works.
Code:
        program main
        real r
        integer length

        length=30
	
        do 10 i=1,length
	r(i)=0
10      continue

	do 20 i=1,length
	print *, r(i)
20      continue	

	return
	end
What I'm trying to do is avoid having the following line:
Code:
	real r(30)

Last edited by halfpower; 12-14-2005 at 04:47 PM.
 
Old 12-14-2005, 05:32 PM   #2
sirclif
Member
 
Registered: Sep 2004
Location: south texas
Distribution: fedora core 3,4; gentoo
Posts: 192

Rep: Reputation: 30
Im afraid not. not in real FORTRAN 77 anyway. you can do it in FORTRAN 90. this is one of the most anoying things about FORTRAN 77 for me. if you are writing some program to solve Laplace's equation and you need an array to hold your data, you can either make the array as big as you think you will ever need it, or you can recompile it every time you want to change the size. anyhow, im rambling.
 
Old 12-15-2005, 08:03 AM   #3
ldenis
LQ Newbie
 
Registered: Nov 2005
Location: Petrozavodsk, Russia
Distribution: FedoraC3
Posts: 1

Rep: Reputation: 0
re:

1/ Install Intel fortran for linux or other with F90 or F95 standarts support.
2/ Use alocatable arrays
integer, allocatable :: a(:), b(:,:,:)
...
allocate (a(3), b(1,3,-3:3))
...
deallocate (...)
3/ Thats's all
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
In C, using qsort for dynamically allocated array ntmsz Programming 7 08-23-2005 10:33 AM
finding array length from a reference (in Perl) lowpro2k3 Programming 1 06-22-2005 04:49 PM
dynamically expanding an array in c++ a1ghagh05t Programming 4 03-07-2004 09:00 PM
How to set the window title for Eterm dynamically? MiscGeek Linux - Software 4 09-29-2003 09:33 PM
finding the length of an array in perl acid_kewpie Programming 5 09-25-2002 10:50 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration