On 04/04/17 05:25, Ryan Joseph wrote:
Is it possible use FillChar on a multidimensional arrays?

arr: array of array of array of integer.
SetLength(arr, 3, 3, 3);
FillChar(arr[0], (3*3*3)*sizeof(integer), false);

I’m just getting crashes.

You can always use FillChar and its kin on specific 'nested' arrays like this

type
  TIntArray = array of Integer;
  TIntIntArray = array of TIntArray;
  TIntIntIntArray = array of TIntIntArray;

  procedure FillArray(const anArray: TIntIntIntArray; aValue: DWord);
  var
    x, y: integer;
  begin
    for x:=0 to High(anArray) do
      for y:=0 to High(anArray[x]) do
        FillDWord(anArray[x][y][0], Length(anArray[x][y]), aValue);
  end;
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to