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

3. Pointers

Thomas Mailund1  
(1)
Aarhus N, Denmark
 
You can store the address of an object in another object, and this is where we get to pointers. A pointer is a variable that stores memory addresses of other objects. You declare a variable to be a pointer by adding an asterisk, *, after the type it points to. If we declare
int i = 1;
int *pi = &i;
int **ppi = π

then i is an integer, pi is a pointer to an integer (it has type int *), and ppi is a pointer to a pointer to an integer (it has type int **, so it is a pointer to int *, which is a pointer to an integer). The pi variable stores the address for i (because we assign pi = &i), and the ppi variable ...

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.