I.T. Discussion Community!
-Collapse +Expand
To/From Code
-Collapse +Expand Cross Ref Guide
-Collapse +Expand Members-Only
Sign in to see member-only pages.
   ► KBTo/From GuidesDelphi  Print This     

Pointers (Delphi and Access VBA Cross Reference Guide)

By Mike Prestwood

Delphi versus Access VBA: A side by side comparison between Delphi and Access VBA.

Data Structures

Data structures allow you to store and work with data. Common data structures include arrays, associative arrays, etc.


[Other Languages] 

General Info: Pointers / References

A pointer is a variable type that allows you to refer indirectly to another object. Instead of holding data, a pointer holds the address to data -- the address of another variable or object. You can change the address value a pointer points to thus changing the variable or object the pointer is pointing to.

A reference is a type of pointer that cannot change and it must always point to a valid storage (no nulls).


Although pointer data types in Delphi coding are less important and not required for most general coding, Delphi fully supports developer defined pointers. Use a carrot (^) to declare a pointer data type. Use the @ operator or Addr function to return the current address of a variable.

Delphi provides typed pointer types such as PChar and PExtended as well as a generic point to anything Pointer type.

Nil is a special pointer value that you can assign to any type of pointer. Nil never points to any valid memory and indicates an unassigned or empty pointer.

Syntax Example:
//Declare a pointer of type integer.
PCounter : ^Integer;
//Assign a value to the location of a pointer.
//Also known as dereferencing.
PCounter^ := 8;
//Assign address of A to B.
PointerB := @PointerA;  //or...PointerB := Addr(PointerA);
Access VBA:   Not Supported

Same as VB Classic. Access VBA does not offer developer defined pointers.

Follow PrestwoodBoards on: 

©1995-2020 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech