Addr

From Free Pascal wiki
Revision as of 23:52, 19 January 2020 by Trev (talk | contribs) (English translation of German page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Deutsch (de) English (en)

addr

Determines the address of a variable.

Example:

  var
   i : integer;
   p : pointer;
 begin
   i := 500;
   p := Addr(i);

   WriteLn(Integer(p^)) ;
   WriteLn('"a" is at the following address:', PtrInt(p));
 end.

Alternative

You can use @ instead of Addr(...).

The two examples below do the same thing.

   p := Addr(i);
   p := @i;

Where @ can also be used to determine the addresses of procedures and functions.

See also


navigation bar: data types
simple data types

boolean byte cardinal char currency double dword extended int8 int16 int32 int64 integer longint real shortint single smallint pointer qword word

complex data types

array class object record set string shortstring