Arwinnd
Arwinnd

Reputation: 35

Can somebody help me with Pascal Lang?

I have a problem with understanding of lists in pascal and pointers. Somebody can help me with this?

Upvotes: 1

Views: 109

Answers (1)

Ilya
Ilya

Reputation: 4689

^datatype means "pointer to datatype object"

variable^ means "value to which variable points"

@variable means "address of variable"

Examples:

var
  value: integer; { value is an integer}
  pValue: ^integer; { pValue is a pointer on integer }
begin
  value := 0;
  pValue := @value; // "@value" is pointer on variable value
  pValue^ := 1; { set 1 to something on which pValue points (equal to value := 1) }
end.

You can read it in wiki: http://en.wikibooks.org/wiki/Pascal_Programming/Pointers

So, ^. means . (access to member) applied to something on which variable points. For example, if you have pRectangle: ^Rectangle (pointer on rectangle), you can get access to it's width: pRectangle^.width

Upvotes: 3

Related Questions