Fork me on GitHub

3/10/2013

[C++] Reference to Pointer

Recently, I met the usage of reference of the pointer as the function parameter. I don't know what the purpose of it, and google the answer for it.

The 1st ref. well explains the difference between "pass by pointer" and "pass by reference of the pointer". The key is the default parameter passing of C/C++ is "pass by value", evne the pointer.

The 2nd ref. shows the situation which the reference of pointer come to solve elegantly

Ref

  1. C++: Reference to Pointer

  2. why pointer to pointer is needed to allocate memory in function

No comments:

Post a Comment