[fpc-pascal] Re: two questions about dynamic array

Howard Page-Clark hdpc at talktalk.net
Wed Mar 13 10:35:43 CET 2013


On 12/03/13 8:30, Xiangrong Fang wrote:
> TMyClass = class
>      myarray: array[0..100] of Integer;
> end;
You could answer such questions yourself:

program Project1;

{$mode objfpc}

type

TMyClass = class
   myarray: array of Integer;
end;

var my:TMyClass;
begin
   my:=TMyClass.Create;
   try
    writeln('After creation the value of my.myarray is 
',PtrUInt(my.myarray));
    SetLength(my.myarray, 0);
    writeln('After SetLength(), value of my.myarray is 
',PtrUInt(my.myarray));
   finally
     my.Free;
   end;
   ReadLn;
end.



More information about the fpc-pascal mailing list