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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access