To add to what others said, try this with and without the printf(...) within the ChangeData(...)
void ChangeData(int **p)
{
int g = 100;
*p = &g;
printf("changed to %d\n", **p);
}
void main()
{
int *q;
ChangeData(&q);
printf("changed to %d\n", *q);
}
Values written into a RAM address are always "logically removed" in that the language won't attempt to use it after it has finished its "life cycle". That doesn't mean that you cannot touch them at all. However, they may also be "physically removed" in that they may be overwritten due to other operations in the same or different application. It is safe and correct to not access it as the value still remaining cannot be counted upon.