binarytree/binarytree.c
/*****************************************************************************/
/* Searches for node with a given value */
Searches for node with a given value
Searches for node with a given value
int lookupVal(Tree *tree, int value){
    Node **foundNode=NULL;
    if (tree && tree->root){
        foundNode = findNodeByVal(&(tree->root), value);
        if (*foundNode){
            printf("    Found node: ID = %i\n", (*foundNode)->id);
            return (*foundNode)->id;
        }
    }
    printf("    Did not find %i in the tree\n", value);
    return -1;
}
int lookupVal ( Tree * tree , int value ) { Node * * foundNode = NULL ; if ( tree && tree -> root ) { foundNode = findNodeByVal ( & ( tree -> root ) , value ) ; if ( * foundNode ) { printf ( " \n " , ( * foundNode ) -> id ) ; return ( * foundNode ) -> id ; } } printf ( " \n " , value ) ; return -1 ; }
Searches for node with a given value
Searches for node with a given value