rendered paste body#include <stdio.h>#include <stdlib.h>typedef struct { void *left; void *right; int ndata; } node;node *Nroot = NULL;node* tsearch(node *root, int search) { printf("Searching %d for %d\n", root, search); if (root == NULL) { printf("\tNot Found\n"); return root; } if (root->ndata == search) { printf("\tFound!\n"); return root; } if (root->ndata > search) {printf("\tLooking LEFT\n"); return tsearch(root->left, search);} if (root->ndata < search) {printf("\tLooking RIGHT\n"); return tsearch(root->right, search);}} void tadd(node *root, int number) { node *newnode = (node *)malloc(sizeof(node)); newnode->ndata = number; newnode->left = NULL; newnode->right = NULL; if (Nroot == NULL) { Nroot = newnode; return; } if (root->ndata == number) return; // if you were storing data with a node, you might use this bit to "update" if (number < root->ndata) { if (root->left == NULL) { root->left = newnode; return; } else { tadd(root->left, number); } } else { if (root->right == NULL) { root->right = newnode; } else { tadd(root->right, number); } }}int main(int argc, char *argv[]) { tadd(Nroot, 1); tadd(Nroot, 3); tadd(Nroot, 2); tsearch(Nroot, 1); printf("\n"); tsearch(Nroot, 2); printf("\n"); tsearch(Nroot, 3); printf("\n"); system("PAUSE"); return 0;}