> For the complete documentation index, see [llms.txt](https://nitinranganath.gitbook.io/data-structures/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nitinranganath.gitbook.io/data-structures/binary-tree/finding-the-height-of-tree.md).

# Finding the Height of Tree

```c
int findHeight(struct Node *ptr) {

    int x, y;
    
    if (ptr) {
        x = findHeight(ptr -> left);
        y = findHeight(ptr -> right);
        if (x > y) {
            return x + 1;
        }
        return y + 1;
    }
    return 0;

}
```

Contributed by Nitin Ranganath
