[fpc-pascal] Array clearing

Ryan Joseph ryan at thealchemistguild.com
Wed Apr 5 04:51:00 CEST 2017


> On Apr 4, 2017, at 11:50 PM, Jürgen Hestermann <juergen.hestermann at gmx.de> wrote:
> 
> I am trying to show the memory allocation for the 10x10 array as a "graphic":
> 
> arr --> arr[0],arr[1],arr[2],arr[3],arr[4],arr[5],arr[6],arr[7],arr[8],arr[9]
>          |      |      |      |      |      |      |      | |      |
>          V      V      V      V      V      V      V      V V      V
>        arr[0,0],       .      .      .      .      .      . .    arr[9,0],
>        arr[0,1],       .      .      .      .      .      . .    arr[9,1],
>        arr[0,2],       .      .      .      .      .      . .    arr[9,2],
> arr[0,3], arr[9,3],
> arr[0,4], arr[9,4],
> arr[0,5], arr[9,5],
> ...                                                            ...
> 
> arr is a single pointer (that points to arr[0]).
> arr[0] to arr[9] are (10) pointers located in a continuous memory block each pointing to
> arr[0,0],
> arr[1,0],
> arr[3,0], and so on...
> arr[0,0] is a single integer.
> arr[0,0] to arr[0,9] are (10) integers located in a continuous memory block.
> The same applies for
> arr[1,0] to arr[1,9],
> arr[2,0] to arr[2,9],
> arr[3,0] to arr[3,9], and so on.

Thanks that helps. Indeed this is not what I need and I’m not even taking advantage of the resizable elements so I better not use dynamic arrays for my matrix.

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list