The size and number of elements in a two-dimensional array of issues delphi

type

TComplex = record
Real : Single;
Imag : Single;

end;

TKArray=array [1..2048,1..2048] of TComplex;

var
lcArr:TKArray;
lcC:Integer;

lcArr2: the Array of the Array of TComplex;
the begin
Memo1.Lines.Clear;
Memo1.Lines.Add ( 'TKArray [2048 X 2048]:');
LCC: = the SizeOf (lcArr);
Memo1.Lines.Add ( 'Total size: '+ the IntToStr (LCC)); {33554432}
LCC: = the SizeOf (TComplex);
Memo1.Lines.Add (' element size: '+ the IntToStr (LCC)); {}. 8
LCC: = the SizeOf (lcArr) div the SizeOf ( TComplex);
Memo1.Lines.Add ( 'number of elements:' + the IntToStr (LCC)); {4194304}
Memo1.Lines.Add ( '------------------ -------------------- ');
Memo1.Lines.Add (' the first number of elements dimension: '+ IntToStr (Length (lcArr ))); {2048 }
Memo1.Lines.Add ( 'number of elements in the second dimension:' + the IntToStr (the Length (lcArr [. 1]))); {2048}
Memo1.Lines.Add ( '----------- --------------------------- ');

Memo1.Lines.Add ( 'dynamic array');
the SetLength (lcArr2,1024,1024);
Memo1.Lines.Add ( 'number of elements in a first dimension:' + the IntToStr (the Length (lcArr2))); {1024}
Memo1 .Lines.Add ( 'number of elements in the second dimension:' + IntToStr (Length (lcArr2 [0]))); {1024}

Guess you like

Origin www.cnblogs.com/h2zZhou/p/11445400.html