Let's work with something easier as an example. Say an int. Let's say we have this code:
Code:
int x = 5;
dosomething(&x);
Now let's say x has an address of 0x12341234. Fair enough? Now the function dosomething() is defined like this:
Code:
void dosomething(int *p)
{
someglobalintptr = p;
}
That saves the value of the address passed to it, right? That means someglobalintptr will contain the value 0x12341234.
Let's say later on in your code, a function is called that uses local variables. Let's pretend it's called performcalculations() and is defined something like this:
Code:
void performcalculations()
{
int y = 100;
.....
}
y might now have the address 0x12341234. Because x, the local variable of the first section of code is gone, the memory will be reused by other local variables (I'm making this extremely simple).
So later on if you print the value of someglobalintptr:
Code:
printf("*someglobalintptr = %d\n", *someglobalintptr);
You'll end up what is inside address 0x12341234. Which could be y instead of x.