I am trying to find a given node (char key[]) in a binary tree and return it to main. My problem is even after I find the node I can't seem to escape from the recursive method. My logic is obviously wrong, but I was thinking: if I find the node I return it to the previous call, then I check that node before attempting to go(call) left or right, if it is the node I want I return that as well, but it just keeps going like a traversal straight through to the end.

This is my code:

PHP Code:

```
[code]
```

TreeNodePtr Search(TreeNodePtr node,char key[MaxWordSize+1]){

if (node != NULL){

if (strcmp(node->data.word,key) == 0) return node;

Search(node->left,key);

if (strcmp(node->data.word,key) == 0)return node;

Search(node->right,key);

}

}

[/code]

Any help would be appreciated.