set_right() takes a pointer as its argument, but you are passing an object.
You need to give the function node2's address in memory:
i did it,
when i printed node.right
it gave me the address of node.right not the key of node2
how can i see the key of node2 ?
bstnode *right is a pointer to another object.
You can access private members of another object by using the arrow operator:
The arrow operator is similar to the dot operator, except it implicitly derefrences the pointer on the LHS before accessing its members. The above statement is equivalent to:
Read more here: http://www.cplusplus.com/doc/tutorial/structures/
Last edited on
Thank you, xish.
if i declare node as pointer then this one doesn't work.
also this one.
also when I'm going to use them as you said, i reach the error below,
The variable 'node2' is being used without being initialized.
actually it became the problem,
the first node (node) is not a pointer and i can use it,
the second node (node2) in a pointer and can be used for node,
But! when I'm going to set the right of node2 here there is a problem
The variable 'node2' is being used without being initialized. (again)
it doesn't get any value as key or any other pointer as right or left,
so if pointer does not get pointer,
and only class substance gets pointer,
and class substance doesn't get other class substances,
then how am i suppose to grow my binary search tree?
Do you mind sharing the code snip-outs so I can help out??