IonicWind Software

IWBasic => General Questions => Topic started by: Allan on October 12, 2007, 12:01:16 AM

Title: Value out of range on line 68
Post by: Allan on October 12, 2007, 12:01:16 AM
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

Title: Re: Value out of range on line 68
Post by: GWS on October 12, 2007, 01:37:24 AM
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
Title: Re: Value out of range on line 68
Post by: Bruce Peaslee on October 12, 2007, 11:44:32 AM
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.