IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
To/From Code
-Collapse +Expand Cross Ref Guide
-Collapse +Expand Members-Only
Sign in to see member-only pages.
   ► KBTo/From GuidesJava  Print This     

Pointers (Java and Delphi Cross Reference Guide)

By Mike Prestwood

Java versus Delphi: A side by side comparison between Java and Delphi.

 
Data Structures
 

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

Pointers

[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).

Java:   Not Supported

Java does not offer developer defined pointers.

Delphi: 

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);












Sales Website: www.prestwood.com Or visit our legacy sales site: 
legacy.prestwood.com


©1995-2024 Prestwood IT Solutions.   [Security & Privacy]