How can I assign a location to a pointer from a pointer within a struct.
if n->left points to "node a;"
how can I make node pointer ptr point to node a?
if you get my drift.
also if i have made a node.
Code:
node nn;
nn.val = 5;
how can i make an existing pointer within a node
which i have a pointer to point to the new node
Code:
int blah (node *mega)
{
node nn;
nn.val = 5;
mega->left = nn;
return 0;
}
doesnt seem to work. Or is this because the function is destroying the new node nn when it finishes?