[futurebasic] Re: [FB] Clearing arrays

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2003 : Group Archive : Group : All Groups

From: barrie <barrie@...>
Date: Tue, 29 Apr 2003 16:37:25 -0400
on 4/29/03 4:16 PM, Jay Reeve at jayreeve@... wrote:

>> on 4/29/03 3:09 PM, Jay Reeve at jayreeve@... wrote:
>> 
>>>  I said:
>>>>  def blockfill(@MyArray(0), (N+1) * (N+1) * sizeof(MyArray(0,0)), 0)
>>>  Oops. I'm sure you figured out that should have been
>>>  def blockfill(@MyArray(0,0), (N+1) * (N+1) * sizeof(MyArray(0,0)), 0)
>>> 
>> Thank you
>> Should the other be
>> def blockfill(@MyArray(0), N * sizeof(MyArray(0)), 0)
>> Instead of
>>> def blockfill(@MyArray(1), N * sizeof(MyArray(1)), 0)
> 
> Barrie,
> 
> That depends on whether you're clearing from element 0 or element 1.
> Your example started from 1, so I did, too.
> 
> If you want to clear from element 0, be sure to include it in the
> size by using (N+1) instead of N:
> def blockfill(@MyArray(0), (N+1) * sizeof(MyArray(0)), 0)
> 
> In the SIZEOF fn, you may use any element of the array, as they're
> all the same size. Since you know the size, you may use it directly
> if you prefer.
> 
Jay
I appreciate your quick response and thanks for the education.
Barrie