[fpc-pascal] question on pointers

dhkblaszyk at zeelandnet.nl dhkblaszyk at zeelandnet.nl
Sun Nov 6 11:06:30 CET 2005


I have a question on copying data to a pointer array. I'm not that into
pointers, so I can't figure out what I'm missing here. I have included
sample code below, and I get a SF on the line where I assign the data to
the pointer.
Is it perhaps that I need to assign memory to the pointer data??

Darius

procedure TForm1.Button1Click(Sender: TObject);
type
  myfloat = extended;
  pmyfloat = ^myfloat;

var
  test: array of pmyfloat;
  test2: array of myfloat;
begin
  setlength(test, 1);

  setlength(test2, 1);
  test2[0] := 3.141;

  test[0]^ := test2[0];

  ShowMessage(floattostr(test[0]^));
end;





More information about the fpc-pascal mailing list