[futurebasic] Re: [FB] Clearing arrays

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

From: Jay Reeve <jayreeve@...>
Date: Tue, 29 Apr 2003 13:45:15 -0500
>Is there a quick way to clear single or multi numeric arrays?
>Something equivalent to:
>FOR x = 1 to N
>   MyArray(x) = 0
>NEXT x

def blockfill(@MyArray(1), N * sizeof(MyArray(1)), 0)

>OR
>FOR x = 0 to N
>FOR y = 0 to N
>   MyArray(x,y) = 0
>NEXT y
>NEXT x

def blockfill(@MyArray(0), (N+1) * (N+1) * sizeof(MyArray(0,0)), 0)

These should do it so fast you won't believe it. Just be sure you get 
the sizes correct, as there is no error checking to see whether 
you're writing past the end of the array.

  e-e
  =J= a  y
   "