I've read many topics about passing pointers to a function by reference, but I couldn't really find an answer. The problem is that after I pass the pointer by reference and change its value, after leaving the function, the value of original pointer doesn't change. I am really stuck with it. Please help me! You're my only hope!
Btw. the code i pasted is the same as the code I need to work on, and I cannot really change the calling of the function. Code:
void f(char *p){
char *np = new char(100);
np = "aaaaaaaaaaaaaaaaa";
p = np;
}
And calling of this function:
void *ptr;
f((char *)&ptr);
I will be very thankful for any help!