Dereferencing Pointer Variables

So far we've used the address-of operator to find the memory addresses of variables. These values have also been stored in pointer variables. Addresses themselves are not really that interesting, though; in the end we want to work with the actual data stored in memory at those addresses. C provides the dereferencing operator (*) to do just that.

Given a pointer variable that contains an address, the * operator allows you to read and write the value stored at the place in memory whose address is stored in the pointer variable. This process is called dereferencing a pointer.

The dereferenced address can be used wherever the original variable could be. So if x is an integer pointer variable, then *x can be used wherever ...

Get C Programming: Visual Quickstart Guide now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.