X
Xiaoshen Li
Dear All,
I thought I understood using pointer variables as function parameters.
But I failed to understand why it is needed pass-by-reference of a
pointer variable.
To me, pointer variable is address variable, which holds the memory
address of the object. Using a pointer variable as a function parameter,
the function has the ability to CHANGE the object value pointed by the
pointer. Why needs pass by reference?
For example, I saw some code like the following:
void myfunctionA(int* pA);
void myfunctionB(int*& pA); //what is the advantage?
Thank you very much.
I thought I understood using pointer variables as function parameters.
But I failed to understand why it is needed pass-by-reference of a
pointer variable.
To me, pointer variable is address variable, which holds the memory
address of the object. Using a pointer variable as a function parameter,
the function has the ability to CHANGE the object value pointed by the
pointer. Why needs pass by reference?
For example, I saw some code like the following:
void myfunctionA(int* pA);
void myfunctionB(int*& pA); //what is the advantage?
Thank you very much.