KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Below is a simple example of using pointer in delphi. Type TRecord1 = Record field1 : String; end; procedure TForm1.Button2Click(Sender: TObject); var Rec : TRecord1; Ptr: ^TRecord1; begin Rec.field1:= 'field1'; Ptr := @Rec; memo1.Lines.Add (Ptr^.field1); memo1.Lines.Add (Ptr.field1); // it also works. end; In such case, Ptr^ and Ptr both work. It seems delphi is to allow user more flexibility in pointing to the value. But just by reading the two lines, they are syntactically different and may mean differently. In such case both work. But my question is: how can a user know in other situations where ^ can or can not be omitted or, where with ^ or without ^ means the same or differently? What are those situations ? Examples will be appreciated. Why? (Optional) Thanks a lot in advance.
Tags (comma-separated)
Save Edits
Cancel