For example:
bool insertInFront( IntElement **head, int data ){
IntElement *newElem = new IntElement;
if ( !newElem ) return false;
newElen->data = data;
*head = newElem; // Correctly updates head
return true;
}
I am new to C++, coming from Java. I get the *
for indirection syntax, but **
is not listed on this page: http://en.wikipedia.org/wiki/Operators_in_C_and_C++#Member_and_pointer_operators
I found this example on page 28 of Programming Interviews Exposed
Update
I realize that this question is naive, and I probably could have found an answer through other means. Obviously, I am new to the language. Still, asking "What does **
mean?" is not well supported online for someone who does not know that **
is a pointer operation. There are very few relevant results when searching C ** syntax
or C++ ** meaning
. Additionally, using ctrl + f
to search **
in the wiki page above, and other documentation, doesn't return any matches at all.
I just wanted to clarify, from a beginner's perspective, that this question is hard to distinguish from the duplicates. Of course, the answer is the same :-) Thank you for the help.