| iMatix home page | << | < | > | >> |
![]() Version 1.91 |
#include "sfltree.h" void *tree_find (TREE **root, void *tree, TREE_COMPARE *comp)
Finds a node with data matching that provided.
{ TREE *current = *root, *found; found = NULL; while (current != TREE_NULL) switch ((comp) (tree, current)) { case -1: current = current-> left; break; case 1: current = current-> right; break; default: found = current; /* In case of duplicates, */ current = current-> left; /* get the first one. */ } return found; }
| << | < | > | >> |
![]() |