[prev] 52 [next]

Pointers (cont)

Now that we have assigned to p the address of variable c
  • need to be able to reference the data in that memory location
Operator * is used to access the object the pointer points to
  • e.g. to change the value of c using the pointer p:

    *p = 'T';  // sets the value of c to 'T'
    

The * operator is sometimes described as "dereferencing" the pointer, to access the underlying variable