qp.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Addr Function
  Summary Details Example                                   Back
 
  Argument
 
    identifier    Identifier for a variable, procedure, or function
 
  Returns
 
    POINTER       Pointer value containing the full address of an
                  argument
 
  Description
 
    The Addr function accepts the identifier for a variable, procedure,
    or function and returns a pointer to the location of the argument
    in memory. The returned value is a 32-bit address containing the
    segment and offset addresses for the argument.
 
    The pointer value cannot be directly dereferenced by a caret (^).
    Assign the return value to a pointer of any type, or cast the
    value to a type and dereference the result of the cast.
 
    To assign and dereference the value:
 
       pointer_variable := Addr( identifier );
       result := pointer_variable^;
 
    To cast and dereference the value, cast to the desired type:
 
       TYPE char_pointer = ^Char;
 
    and then dereference the value:
 
       char_variable := char_pointer(Addr( identifier ))^;
 
    To return a pointer to an array element:
 
       pointer_into_array := Addr( array_name[n] );
 
    To return a pointer to a field within a record:
 
       pointer_to_field := Addr( record_name.field_name )
 
    Both the Addr function and the unary operator (@) produce the same
    result. Note that the (@) operator (like all operators) does not
    require parentheses.