pointers

closed account (STR9GNh0)
NodePtr temp = new Node;
temp -> data = item;
temp -> next = head;
head = temp;


can anyone enlighten what it means for the above? thanks.

1) allocates a Node object Dynamically, NodePtr is some sort of typedef or class wrapper for a pointer http://www.cplusplus.com/doc/tutorial/dynamic/
2/3 ) access some member of the object pointed by temp ( p->x is the same as (*p).x )
The four line look to be part of an insertion function in a list structure
closed account (STR9GNh0)
it is. But i don't understand what it means ~ thanks for the URL, i will try to read up on it and hopefully i could understand better with it.
closed account (STR9GNh0)
hmm.. i finish reading it but i still don't understand.

what does the -> implies?

don't know if i am right.

temp -> data = item;

means..

temp implies data equals item?
see 2/3) from my previous post
( the numbers refer to the line number in your first post )
closed account (STR9GNh0)
oh, okays, thanks~
Topic archived. No new replies allowed.