Please avoid global variables when you can. Declare and initialize the root itself inside main instead, and then pass around your root into functions.
Edit: In your case it wasn't global.
Gando, root isn't public. Here is the snippet with indentation that reflects the structure:
1 2 3 4 5 6 7 8 9 10
class Tree
{
protected:
struct Node
{
int i;
Node* left, *right;
} *root;
...
};
Gopinathpc, I don't think Peter87 was suggesting that you should inherit anything. He's saying that if you aren't deriving a new class from Tree, then it makes no different whether Node and Root are public or private.