What are the different pointer types used in Pascal?
What are the different pointer types used in pascal?
- Record pointers are the pointers that allow the recording of the node and the sub-fields that are being used.
- Reference pointers: Pointers are the reference to the dynamically created variables that doesn’t allow the references to be done in static or local variables.
- Associate type pointers: Pointers have an associated data type with them so that one type can be check for compatibility with another type.
- It helps in eliminating the security concern and allows easy implementation of the pointer used in the language.
- This allows the risk to be removed in case of using the dangling pointers and it dynamically allows the use of Dispose function that manages the risk.
- Example of the pointer is as follows:
type
pNode = ^Node;
Node = record
a : integer;
b : char;
c : pNode {extra semicolon not strictly required}
end;
var
NodePtr : pNode;
IntPtr : ^integer;
- The NodePtr is a variable pointer that is pointing to the data type of Node that is a record. Pointers are used before they are declared.