void find_matches(bst_node_type *head, int arg_count, char **args)  {
    
    data_item_type *item;


   	item=0;


    //use the built-in functionality of a BST and find by the key value

    item=find_node_by_key(head, make_key_from_name(args[1]));

    if (item) {

        while (item!= 0) {

            if (strcmp(args[1], item->name)==0 ) {
                printf("@s\n", item->name);
                break;
            }
            else
                item=item->next;

        }
        
    }
}
Exemple #2
0
int main(){

    node *head = NULL;
    push_back(&head, 1);
    push_back(&head, 2);
    push_back(&head, 3);

    node *target = find_node_by_key(&head, 3);
    add_after(&head,&target, 10);


    print_list(&head);
    print_list_reverse(&head);
    return 0;
}