Out of Bounds Problems

BlitzMax Forums/BlitzMax Beginners Area/Out of Bounds Problems

Why0Why(Posted 2006) [#1]
I keep getting out of bounds when I run the following function on the sdir array. It usually happens on the last line, but occassionally on the line before. In debug trace, it is only showing values assigned to element 0,1,2,3. Any suggestions?



Thanks much,


undomiel(Posted 2006) [#2]
Well the only thing I see is that shouldn't you be declaring the array like:

local sdir:Int[] = New Int[5]


I'm also noting that sdir[0] is going unused.


TomToad(Posted 2006) [#3]
Are you sure you're posting that exactly like it's in your program? I can't even compile the line
Local sdir:Int[5] = New Int[5]

Try doing it the way undomiel has it, or even better, if you are not going to be redimentioning the array later, just use
Local sdir:Int[5]