Hi
I am new to C++ and obviously I have a few questions.
Code:
// If I declare a node like this
typedef struct NODE
{
int *data;
NODE *next;
}Node;
// And I have created a variable of this
// type and allocated memory for it like this
Node *rootp = new Node;
// I understand I have to allocate
// Memory for the variable *data
// to use it..
rootp->data = new int;
rootp->data = 10;
Now, I know there is a mistake above, but I am not sure why - my understanding of pointers is limited, I'm good if it is a single variable, but I get confused when I am face with structures or function arguments...