Hi all

during my implementation to tree data structure, I make a method which combine two trees in one tree and called it attach.
I declared 3 trees t1,t2,t3.
and then called method attach which will create new tree and put t1 in right and t2 in left and then store it in t1.
and this method works correctly.(discovered that by debugging)

and then called this method again with t1 and t3

once the compiler enter the this method again t1 becomes null and the program crashes

t.Attach(&t1,&t2);
t.Attach(&t1,&t3);

I don't know what causes this problem.

I'm waiting to any help.

I fix the problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.