<aside> <img src="/icons/home_green.svg" alt="/icons/home_green.svg" width="40px" />
</aside>
https://jennychen9827sbu.github.io/CAD281/pointers.html
A pointer in C is a variable that stores the memory address of another variable.
For example:
int a = 10;
int *p = &a; // p is a pointer to int, storing the address of a
p is the value at the address (dereferencing)&a is the address of variable aUse pointers to:
#include <stdio.h>
int main() {
int num = 5;
int *ptr = #
printf("Value of num: %d\n", num);
printf("Address of num: %p\n", &num);
printf("Pointer ptr stores: %p\n", ptr);
printf("Value at pointer ptr: %d\n", *ptr);
return 0;
}
Here, *ptr accesses the value stored at the memory address held by ptr.