Question: Please help with C++. Binary trees. when I compile , I get an exception Thread 1: EXC_BAD_ACCESS (code=1, address=0x0). How do you fix it. Thanks

Please help with C++. Binary trees. when I compile , I get an exception Thread 1: EXC_BAD_ACCESS (code=1, address=0x0). How do you fix it. Thanks

//Removing a node from the tree

void BinTree ::remove (RecType rec )

{

rremove (root, rec);

}

void BinTree ::rremove (NodePtr & nodep, RecType rec)

{

//the error is coming from here

if (rec.id < nodep->id) / / ////here i get a breakpoint, showing a bad address.

rremove(nodep->llink, rec);

else if (rec.id > nodep->id)

rremove(nodep->rlink, rec);

else

makeDeletion(nodep);

}

struc...

class...

int main(){

Rectype r;

r.members=informaiton;

tree.remove(r);

cout << "Removing...";

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!