Hi!

In my code I often use 2D arrays.
Until today, I kept the maximum dimension fixed to 400 * 300 points.
How can I make allocatable columns of ARBITRARY size?

For simplicity here a 1D reduction of the problem:

This is what I have:

CONST
  MaxN = 400;
TYPE
  ColumnType = ARRAY[1..MaxN] OF Float;

Recently, some of my grids were so large that having all my grids use the 
same maximum size
would cost too much memory. Therefore, I would like to dynamically 
allocate space
when the actual dimensions of a grid are known. I found:

TYPE
  ColumnTypePtr = ^ColumnType; 
VAR
  Column : ColumnTypePtr;
...
NEW(Column);

and now I have a column of size 400.

--> Question: How can I make allocatable columns of ARBITRARY size?

Thanks,


Arjan





Disclaimer RIVM
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to