fillArray

Syntax

bool fillArray (int nr, int val)

Arguments

nr
Number of the Array. Values from 0 to 99 are allowed.
val
Value to fill array

Return

Returns true if successful, or false if an error occurred (e.g., incorrect value for nr or byte-size of Array).

Description

Function for filling an array with a certain byte, short, integer, or double value, e.g. for initializing all cells of the array to zero. If the byte-size of the Array is 1, 2, or 4, then val is converted to an 8-bit, 16-bit, or 32-bit integer as needed. If the byte-size of the Array is 8, then val is converted to a 64-bit (double)? floating-point value (not a 64-bit integer!) for storage in the Array.

Example

%ffp

OnFilterStart:{

  allocArray (0,100,0,0,1);
  fillArray (0, 112);
  Info ("The array was filled with the value: %d", getArray(0, rnd(0,99) ,0,0) );
  freeArray(0);	
  
  return false;
}

Also see

ffillArray, allocArray, freeArray, getArray, putArray, getArrayDim, copyArray

Comments

Note that the use of fillArray to store a 64-bit floating-point value in the Array is deprecated; use ffillArray instead.