samedi 25 avril 2015

Pointer for pointer


I try to insert new node to tree without using recursive function.

Root is global defined first node of tree.

node *tree;
tree=&root;

.......

(tree->tab[first])=(node*)malloc(sizeof(node));

Where node is my own defined structure. I want to have handle to root, so I make new pointer, which I will use to move on tree. I m very suprised because new allocated nodes arent assigned to my root. How can I do that? How can edit root by editing tree.

Please help, I have spent hours for that problem. Greetings


Aucun commentaire:

Enregistrer un commentaire