Variables which contain memory addresses are called pointers.
As we saw in the previous section, we can store memory addresses in
However, we then don't know the type of the data stored at those addresses.
If it is important (or useful) to know this then the
PTR type (or, more accurately, one of the many
PTR types) should be used.
DEF p:PTR TO LONG, i:PTR TO INT, cptr:PTR TO CHAR, gptr:PTR TO gadget
The values stored in each of
LONG since they are memory addresses.
However, the data at the address stored in
p is taken to be
LONG (a 32-bit value), that at
CHAR (an 8-bit value), that at
INT (a 16-bit value), and that at
gadget, which is an object (see 9.4
Since pointers are just data like any other
LONG variable, the value of the pointer is somewhere in memory.
This means it has an address, so you can have a pointer which is actually pointing to another pointer!
This is one of the reasons pointers can be quite difficult to think about, and misunderstanding them is often the cause of big problems with programs.
Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.