is there way point pointer variable instead of it's address space can changed null. this. apologies poor question can't think of better way of expressing i'm trying do. thanks.
typedef struct node { int val; struct node *r; struct node *l; } node; node* del(node *n, int v) { node *n = n; node **p = null; while (n != null) { if (something) { p = n.r; n = n->r; } else { p = n.l; n = n->l; } free(n); *p = null; } }
you can use &
on pointer on other variable. in case, looks might want change del
to:
node *del(node **n, int v)
and call like:
x = del(&somenode, 12);
Comments
Post a Comment