[futurebasic] Re: [FB] Re : [FB] Array Bounds

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 1999 : Group Archive : Group : All Groups

From: Rick Brown <rbrown@...>
Date: Mon, 07 Jun 1999 20:17:39 -0500

Al Boyd wrote:

> >I think you're confusing FutureBasic with "C"  :-)
> >
> >In fact, if you have the "start at zero" pref set, "DIM myRecord(5)" reserves
> >space for _six_ records, numbered myRecord(0) through myRecord(5).
> >
> >- Rick
>
> I be confused...
>
> The book; "Programming the Macintosh with FutureBasic"
>
> In the "Array variables" chapter it states...
>
> The following program line creates a character string
> array with six elements, myName$(0) through myName$(5):
>
> DIM myName$(6)    'create 6-elements
>
> Has something changed?
> or
> Is this a misprint?
> or
> Is Rick be confused?

My guess is: "misprint".  Try this experiment, to show how much space is
allocated:

DIM x%(5),y%(5)
DIM z%(5,10)
PRINT "Should be 12, not 10: ";(@y%(0) - @x%(0))
PRINT "Should be 22, not 20: ";(@z%(3,0) - @z%(2,0))

- Rick