I have a problem with pointers that I don't know how to resolve. My pointer p points to a certain adress in memory. I want to point pointer q to the exact same adress. After that, I want to point pointer p to NULL. The problem is that after I do this, pointer q points to NULL as well, but I want him to keep pointing to the initial adress. Is there a way to do this? Here is a simple code of what I want to do:
int* p = &a; //pointer "p" now points to "a"
int* q;
q = p; //pointer "q" points to "a" as well
*p = NULL; //pointer "p" points to NULL
printf("%d", *q); //pointer "q" points to NULL as well, but I want him to keep pointing to "a"