How to allocate an array of type T with a length of N million in Pascal

1 Answer

0 votes
program Main;

{$mode objfpc} // Enable Object Pascal features

type
  T = Byte;

var
  size: Integer;
  arr: array of T;

begin
  size := 10000000; // 10 million

  SetLength(arr, size);

  WriteLn(Length(arr));
end.




(*
run:

10000000

*)

 



answered Jul 1, 2025 by avibootz
...