If the array is rectangular you can do
You can do that with any dimension as long as the array is planar in all dimensions (any dimension) and given memory boundary limitations. You can flatten the array given x,(((y z),y)(z,v)),z,v) order.
You can even declare an array type of different dimensions as absolute on any other planar array. Given memory limitations. e.g. 8086 --> 64K
In Bart's case I would declare twice the array at the same location using absolute.
var
a:array[0..9,0..9] of integer;
b:array[0..99] of integer absolute a;
Proof:
program arrayfun;
{$ifdef fpc}{$mode delphi}{$H+}{$I-}{$endif}
var
a:array[0..2,0..2,0..2] of integer; //3 dimensions
b:array[0..26] of integer absolute a;//1 dimension
i,j,k:integer;
begin
for i := 0 to 26 do b[i] := i;
for i := 0 to 2 do
for j:= 0 to 2 do
for k := 0 to 2 do
writeln(a[i,j,k]); // the cumbersome way to write out b[]
end.
In principle this goes for any array that is planar with any dimension. e.g 0..x,0..y, depth, time.. etc
Note this is NOT implementation detail. It is how arrays work. Mathematically too, they are symmetrical functions of each other a=f(b) and b=f(a) representing the same data in any order. The compiler may have to work around this given memory limitations, as explained. Planar, because the dimensions need to be related by a power function. It does not need to be square, but needs to be a rectangle (of possibly different size ) in all directions. E.g:
program arrayfun2;
{$ifdef fpc}{$mode delphi}{$H+}{$I-}{$endif}
var
a:array[0..1,0..7,0..3] of integer;
b:array[0..63] of integer absolute a;
i,j,k:integer;
begin
for i := 0 to 63 do b[i] := i;
for i := 0 to 1 do
for j:= 0 to 7 do
for k := 0 to 3 do
writeln(a[i,j,k]);
end.
Oh and the answer:
type
T2DArr = array of array of Boolean;
var
A, B: T2DArr;
begin
SetLength(A, 20, 10);
B:= A;
end.