Passing a pointer as a reference
Hi,
I have a function name fun1(), in which there is a pointer say ptr1. I am passing this pointer to fun2() and in fun2() there are some changes that are being made to that pointer (say some increment or allocation to some structure).
I want that modification to be reflected in fun1(), i don't want to return it from fun2(). What i want is that fun2() receive this pointer as a reference to original pointer and any changing made to it will be reflected in fun1().
i am doing this
Code:
void fun1()
{
someStruct *ptr = null;
fun2(ptr);
.
.
.
ptr -> someThing = 3;
}
void fun2 (someStruct &ptr)
{
ptr = new someStruct();
ptr++;
}
but it is not working ... :(.
can you people help me ... please