I'm starting to learn object pascal and I have a little problems about pointers. I have this type:
TMailingListRecord = record
FirstName: string;
LastName: string;
Address: string;
City: string;
State: string;
Zip: integer;
end;
PMailingListRecord = ^TMailingListRecord;
and when I access the property of the record after allocation it gives me an error:
ptr := allocmem(sizeof(TMailingListRecord));
ptr.FirstName := 'Per';
ptr.LastName := 'Larsen';
showmessage(ptr.LastName + ', ' + ptr.FirstName);
freemem(ptr);
The errors are:
Unit1.pas(85,7) Error: Illegal qualifier
Unit1.pas(85,7) Hint: may be pointer dereference is missing
Unit1.pas(85,7) Error: Illegal expression
Unit1.pas(85,7) Fatal: Syntax error, ";" expected but "identifier FIRSTNAME" found
ptr btw is ptr := PMailingListRecord. Can anybody point me to a right direction? Thanks.