Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Array Accessed out of Bounds?

Author
Message
GoldD Dragon27
19
Years of Service
User Offline
Joined: 12th Aug 2005
Location:
Posted: 19th Aug 2005 01:06
I have DIM'd 2 arrays at 32,32

While reading areas on my map i am trying assign data to these arrays.

Error message "Array Accessed out of bounds"

Does anyone have access to an "error report list" and what each error means or how do I get this info?
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 19th Aug 2005 04:02
It means somewhere in your code your trying to access the dim statements beyond 32.

In this code "test" is dimensionalized at 23... the for next loop tries to print test(0) to test(24)... but because it's dimensionalized at 23 it'll produce an error when it tries to print test(24).

John Y
Synergy Editor Developer
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: UK
Posted: 19th Aug 2005 12:44 Edited at: 19th Aug 2005 12:45
There is no 'error report list', you have to make do with the (sometimes) cryptic error messages that you get. As long as you know your technical terms though, you can work out what the error means.

GoldD Dragon27
19
Years of Service
User Offline
Joined: 12th Aug 2005
Location:
Posted: 19th Aug 2005 19:52
The array is DIM'd (33)?

The reading elements are 32?

What Next?
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 19th Aug 2005 21:32
Post the code which is causing the problem.

How can we be sure that your code isn't trying to access element 33 - even though you dimensioned with 32.

What variable are you using for the array index?

TDK_Man

GoldD Dragon27
19
Years of Service
User Offline
Joined: 12th Aug 2005
Location:
Posted: 20th Aug 2005 18:51
Oopps.

Sorry guys. Problem solved.

I am working with Reading Points of a Bitmap and Making Matrices.

I forgot to resample my new BMP down to 32x32 before running program.

Program is fine, error is gone.

Login to post a reply

Server time is: 2025-05-22 13:39:07
Your offset time is: 2025-05-22 13:39:07