"Crow" <jo******@yahoo.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
Your right Raju, I missed that. It should have been:
Object *temp;
temp = getNextNode();
Did you mean:
temp = (*node)->getNextNode();
?
node = &temp;
Anyway, I get what your said Alan. That makes sense now. I had a
mental lapse dealing with pointers to pointers. Thanks for the tip.
You do realize that now node holds the address of the local variable temp,
right? Is that what you really want, to keep the address of another
(temporary) pointer?
I can't say I've seen much (if any) use of pointer-to-pointers within a
function. Usually, they're just passed as parameters, such as Object**
node, and then *node is operated on directly within the function. That's so
that you can modify the pointer passed to the function. And if that's what
you're really doing here, then when the function exits, node will be
pointing at a local variable that's going out of scope, and you'll be in
trouble.
(And what happened to the old pointer that node previously pointed to? Does
someone else own it? Was it leaked?)
-Howard