March 29, 2024, 12:56:20 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Value out of range on line 68

Started by Allan, October 12, 2007, 12:01:16 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Allan

Creative Basic

Running the prog Heapsort.cba produces an error when you enter the number 555

The error says Value out of range on line 68


GWS

Gosh .. how on earth did you spot that Allan ..  ;D

The beauty of CBasic is you can just put a 'Stop' statement ahead of the error line, and have a look what's going on.
In this case it's an array overflow, since array A[] is only set for 554 elements.

Just change the def statement for A[] to:

def testarray[maxsize+1]:string

and all then seems to work ..  :)

best wishes,

Graham
Tomorrow may be too late ..

Bruce Peaslee

I'm moving this to the CBasic area, but it looks like it is taking me two hops.   :P

Edit:  Oops again - I am not a Moderator here so I can't move it.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles