Addr/de: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Addr/de
| Old | New | Line | |
|---|---|---|---|
| 1 | + | # Addr | |
| 2 | + | ||
| 3 | + | Ermittelt die Adresse einer Variablen. | |
| 4 | + | ||
| 5 | + | ## Beispiel | |
| 6 | + | ||
| 7 | + | ``` pascal | |
| 8 | + | var | |
| 9 | + | i: Integer; | |
| 10 | + | p: Pointer; | |
| 11 | + | begin | |
| 12 | + | i := 500; | |
| 13 | + | p := Addr(i); | |
| 14 | + | ||
| 15 | + | WriteLn(Integer(p^)); | |
| 16 | + | WriteLn('"a" befindet sich an folgender Adresse: ', PtrInt(p)); | |
| 17 | + | end. | |
| 18 | + | ``` | |
| 19 | + | ||
| 20 | + | ## Alternative Schreibweise | |
| 21 | + | ||
| 22 | + | Anstelle von **Addr(..)** kann man auch ein **@** nehmen. | |
| 23 | + | ||
| 24 | + | Folgendes macht das Gleiche. | |
| 25 | + | ||
| 26 | + | ``` pascal | |
| 27 | + | p := Addr(i); | |
| 28 | + | p := @i; | |
| 29 | + | ``` | |
| 30 | + | ||
| 31 | + | Wobei man mit **@** auch Adressen von Prozeduren und Funktionen ermitteln kann. | |
| 32 | + | ||
| 33 | + | ## Siehe auch | |
| 34 | + | ||
| 35 | + | [[Pointer/de|Pointer]] | |
| 36 | + | ||
| 37 | + | Autor: Mathias | |
| 38 | + | ||
| 39 | + | --- | |
| 40 | + | *From the Free Pascal wiki, page "Addr/de", as it stood on 2020-01-19 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
