Help me understand pointers

Hello, I am having trouble grasping pointers, they seem really confusing. Could you explain it to me and then maybe show an exmaple or two. I heard pointers are very important so I don't wanna just skip them.

basically a pointer is the address to some sort of memory within the computer. Here is an example of a little bit of code:
1
2
3
4
int *p; //declaring a pointer
int i = 5;
p = &i; //sets the pointer to the address of i, the memory location of i
printf("the pointer p is %d\n", *p); //the "*" before the pointer tells the pointer to get the value at the address it is assigned to, so p = 5 


Pointers do become very handy in programming because it can allow values to be changed throughout functions if it needs to.
So, basically, p takes the variable I and sets it as there memory thing?
when you do i = 5, i is set into memory with the value of 5. the pointer p just basically points to where this memory is (the address). using "*" allows you to get the value from where that address is pointing to within memory.
Thanks, I get it now
Topic archived. No new replies allowed.