[fpc-pascal] Array clearing

Ryan Joseph ryan at thealchemistguild.com
Tue Apr 4 16:54:48 CEST 2017


> On Apr 4, 2017, at 9:46 PM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> 
> SetLength() allocates a single block of memory, cause array access is
> ordinary pointer arithmetic. However if you have an array of array then
> the first array stores a pointer to each sub array.
> 
> E.g. the following would be valid, too:
> 
> === code begin ===
> 
> var
>  arr: array of array of Integer;
> begin
>  SetLength(arr, 10, 10);

“then the first array stores a pointer to each sub array.”

Could you illustrate this is code? I don’t think I’m understanding this exactly like it’s represented in memory. There’s only one “sub array” in this 2x2 array so how does that look in memory?

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list