this is a code for insert in bst that i have written
but while inserting third element in the tree the program crashes
and i found out the error is in red statement if i remove it the program runs as normal
can someone help me in removing it and letting me understand what is this error.
Code:struct def struct tree { int data,color; struct tree *left, *right,*root; }; typedef struct tree* RB; below is erroneous insert routine int rb_insert(int val,RB *node,RB top) { RB temp; if(*node==NULL) { temp=(RB)malloc(sizeof(RB)); temp->root=top; temp->left=NULL; temp->right=NULL; temp->data=val; *node=temp; return; } if((*node)->data>=val) { rb_insert(val,&(*node)->left,*node); } else { rb_insert(val,&(*node)->right,*node); } return ; }



LinkBack URL
About LinkBacks



