Array First Index in Fortran -
i thought first index of array in fortran 1. why code work? (code modified segment of wavewatch, http://polar.ncep.noaa.gov/waves/wavewatch/)
do kindex=0, total+1 num = num * scale sig (kindex) = num end
as you've been told fortran array indexing is, default, 1-based programmer can choose integer within range of integer kind used index values. there is, though, wrinkle of should aware. fortran doesn't default, either @ compile-time (where impossible in many cases) or @ run-time (possible expensive), check array index expressions in bounds.
there lot of fortran code in wild problem , i've come across cases program has worked, apparently correctly, many years without being spotted. use compiler's options create version of program checks array bounds expressions @ run-time, run , see happens.
or, you've been told, sig
may have been declared 0
lowest index.
Comments
Post a Comment