#include #include struct Node { int key; const struct Node *left; const struct Node *right; }; static bool contains(const struct Node *node, int key) { while (node != NULL) { if (key == node->key) { return true; } node = key < node->key ? node->left : node->right; } return false; } int main(void) { struct Node low = {12, NULL, NULL}; struct Node high = {30, NULL, NULL}; struct Node root = {20, &low, &high}; printf("Found 30: %d\n", contains(&root, 30)); printf("Found 25: %d\n", contains(&root, 25)); return 0; }