BSTNode *bst_search(BSTNode *root, int key) {
while (root != NULL) {
// 本轮比较 root->key,查找长度加 1。
if (key == root->key) return root;
// 小于走左子树,大于走右子树。
if (key < root->key) root = root->left;
else root = root->right;
}
// 走到空指针,查找失败。
return NULL;
}