Pointers on pointers

A few quick notes on pointers:

  • A pointer variable holds the memory address of what it points to
  • A type must be declared along with a pointer variable; this denotes the type of what is being pointed to rather than the type of the pointer variable itself
  • When declaring a pointer, an * can be placed either directly against (after) the type name, with a space on either side, or directly against (before) the variable name. The Unreal standard is to use the first of these.
  • an * before the (previously declared) variable name dereferences the pointer, meaning it will return the value being pointed to - i.e. what is stored in the memory address (possibly also using subsequent addresses) that the pointer references.
  • The -> notation accesses the dereferenced value or object, so for example allows calling methods directly, similar to the use of dot notation on the object itself.

Privacy & Terms