Forum > Beginners

Where is Special Characters Reference

(1/2) > >>

flywire:
Where is the reference for special characters such as hex and pointer etc?

marcov:
In the reference manual?  & is octal, % is binary and $ is hex.    # is character (and can be combined with the others, so #$15 is the character with hexcode 15)

flywire:
Yes, this is what I was looking for.

1.1 Symbols

* The following characters have a special meaning:
... ^ @ ... $ # & %1.6 Numbers

* $ Hex, & Octal, % Binary1.8 Character strings

* # Char
Now, what about the ^ @ characters which first appear in 3.2 Character types?
^ is pointer and @ is an address but it doesn't mean much to me.


Thanks

Bart:

--- Code: ---type
  TFoo = record X: Integer; end;
  PFoo = ^TFoo; //PFoo is a pointer to a TFoo structure
var
  Foo: TFoo;
  P: PFoo;
begin
  Foo.X := 1;
  P := @Foo; //P now points to Foo
  writeln(Foo.X); //shows 1
  writeln(P^.X); //shows 1, the ^ after is called dereferencing
  Foo.X := 2;
  P^.X := 3;
  writeln(Foo.X); //shows 3, since P^.X is the same as Foo.X
end.

--- End code ---

Bart

flywire:
A reference in the wiki under tutorials has a good page on pointers:  http://www.delphibasics.co.uk/Article.asp?Name=Pointers

Two snippets:
* myCharPtr := Addr(myString);
Neil explains that 'the @ character can equally be used instead of the Addr function'. This does it for me - it's just a function.
* ShowMessage(myCharPtr^)
"...we use the ^ character at the end of the pointer name to refer to what the pointer points to." So read it as 'points to' like := is read becomes.

Navigation

[0] Message Index

[#] Next page

Go to full version