© Thomas Mailund 2021
T. MailundPointers in C Programminghttps://doi.org/10.1007/978-1-4842-6927-5_4

4. Pointers and Types

Thomas Mailund1  
(1)
Aarhus N, Denmark
 

If pointers simply hold memory addresses, why do they have different types? Isn’t a memory address just a memory address? Usually, yes, an address is simply an address on a modern architecture, but the language standard doesn’t guarantee it. Pointers to different types are allowed to have different representations if the underlying hardware requires it (with a few rules for how you can convert between them), and you should be careful with assuming that they hold the same kinds of addresses.

Even if a pointer merely holds an address, and all addresses are equal, there are still at least three ...

Get Pointers in C Programming: A Modern Approach to Memory Management, Recursive Data Structures, Strings, and Arrays now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.