 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
lawchellie
Joined: 22 Dec 2011 Posts: 8
|
Posted: Fri Dec 23, 2011 12:48 pm Post subject: array rank error! |
|
|
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 |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Fri Dec 23, 2011 1:37 pm Post subject: |
|
|
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 |
|
 |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Fri Dec 23, 2011 2:30 pm Post subject: |
|
|
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 |
|
 |
|
|
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
|