[fpc-pascal] question on pointers
florian at freepascal.org
Sun Nov 6 11:30:53 CET 2005
Adriaan van Os wrote:
> dhkblaszyk at zeelandnet.nl wrote:
>> 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??
>> procedure TForm1.Button1Click(Sender: TObject);
>> myfloat = extended;
>> pmyfloat = ^myfloat;
>> test: array of pmyfloat;
>> test2: array of myfloat;
>> setlength(test, 1);
>> setlength(test2, 1);
>> test2 := 3.141;
>> test^ := test2;
> I suggest you read a tutorial on pointers. They can be very dangerous,
> so you should know what you are doing.
Even worse when combining them with dyn. arrays. As soon as you do a
setlength(test,x); all previous references to elements of test might be
More information about the fpc-pascal