Let's work with something easier as an example. Say an int. Let's say we have this code:
Now let's say x has an address of 0x12341234. Fair enough? Now the function dosomething() is defined like this:
int x = 5;
That saves the value of the address passed to it, right? That means someglobalintptr will contain the value 0x12341234.
void dosomething(int *p)
someglobalintptr = p;
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:
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).
int y = 100;
So later on if you print the value of someglobalintptr:
You'll end up what is inside address 0x12341234. Which could be y instead of x.
printf("*someglobalintptr = %d\n", *someglobalintptr);