<p>Am 04.04.2017 13:55 schrieb "Ryan Joseph" <<a href="mailto:ryan@thealchemistguild.com">ryan@thealchemistguild.com</a>>:<br>
><br>
><br>
> > On Apr 4, 2017, at 4:58 PM, Howard Page-Clark via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> wrote:<br>
> ><br>
> > You can always use FillChar and its kin on specific 'nested' arrays like this<br>
> ><br>
> > type<br>
> > TIntArray = array of Integer;<br>
> > TIntIntArray = array of TIntArray;<br>
> > TIntIntIntArray = array of TIntIntArray;<br>
> ><br>
> > procedure FillArray(const anArray: TIntIntIntArray; aValue: DWord);<br>
> > var<br>
> > x, y: integer;<br>
> > begin<br>
> > for x:=0 to High(anArray) do<br>
> > for y:=0 to High(anArray[x]) do<br>
> > FillDWord(anArray[x][y][0], Length(anArray[x][y]), aValue);<br>
> > end;<br>
><br>
> Doesn’t iterating the array default the purpose of FillChar? The goal was the most efficient way clear the array with zero’s. Even if the array if nested 3 levels deep (anArray[x][y][z]) it should (I hope) be a contiguous block of memory that was allocated (correct me if I wrong please).<br>
></p>
<p>As I wrote that isn't the case. Each dynamic array is allocated independently (and thus you could also resize each subelement independently).</p>
<p>If you want continuous memory areas you need to use static arrays or develop your own dynamic data structure that uses array properties.</p>
<p>Regards,<br>
Sven</p>