replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - array rank error!
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

array rank error!

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
lawchellie



Joined: 22 Dec 2011
Posts: 8

PostPosted: Fri Dec 23, 2011 12:48 pm    Post subject: array rank error! Reply with quote

tried to run a program but having this error, pls help me out!

C:\projects\job1.F95(10) : error 199 - Array RAINFALL appears in this expression as rank 1, but was declared as rank 2
C:\projects\job1.F95(13) : error 199 - Array RAINFALL appears in this expression as rank 1, but was declared as rank 2
Compilation failed.

here is the program:

implicit none
real :: Total=0.0, Average=0.0
real, Dimension(1,12) :: RainFall
integer :: Month
print*, 'type in the rainfall values'
print*, 'one per line'
do Month=1,12
read*, RainFall(Month)
enddo
do Month=1,12
Total=Total+RainFall(Month)
enddo
Average=Total/12
print*, 'Average monthly rainfall was'
print*, Average

end
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Fri Dec 23, 2011 1:37 pm    Post subject: Reply with quote

Dimension(1,12) declares a 2 dimensional array with the first index going from 1 to 1 and the second index going from 1 to 12.
Back to top
View user's profile Send private message AIM Address
davidb



Joined: 17 Jul 2009
Posts: 560
Location: UK

PostPosted: Fri Dec 23, 2011 2:30 pm    Post subject: Reply with quote

Change

real, Dimension(1,12) :: RainFall

to

real, Dimension(1:12) :: RainFall
_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group