In short, they are variables that contain the memory address of another variable, that is, they refer to the memory location of the other variable. This ensures us to quickly access the stored information.
For example:
address = 0, 1, 2, 3, 4, 5 variable = a, b, c, d, e, f value = ?, ?, 4, 9, ?, 5We see that the variable "d" is at memory address 3 and that its value is "9".
To access its value very quickly, you just have to create a pointer to that memory address.
int d = 9; int *p = &d printf("Address of 'd': %p\n", &d); result: Addres of 'd': 3 printf("Value of 'p': %p\n", p); result: Value of 'p': 9this would indicate that "*p" is pointing to the memory address of the variable "d" so you can access its value faster.
If we want to access a memory location (X) to change its value, it would be something like:
struct point { int x; int y; }; struct point my_point = { 3, 7 }; struct point *p = &my_point; printf("%p", p); result: {3, 4} p->x = 5; p->y = 6; printf("%p", p); result: {5, 6} Or you can also assign a new value like this (*p).y = 5