Out of Bounds Error
Page Last modified: 21 January 1999
- Sometimes indicated as an "operand range error" in
an error message.
- Example code:
        parameter (nx=11)
        dimension x(nx)
        xrange=1.
        dx=xrange/float(nx-1)
        x(1) = 0.
        do 1 i=1,nx
        x(i+1)=x(1)+float(i-1)*dx
    1 continue
- Comments:
When i=nx this code writes to x(nx+1) which is outside
the array bounds of x. Hence, it could overwrite some other
variable, sometimes part of the source code!
Back to
ATM 150 homepage