I posted it in C programming forum earlier, so getting back to the right forum.

how can i write a function to return HRESULT, i Don't know what is HRESULT and how should it be used for, googled it and found that, HRESULT can be used to represent the error condition in our program, will not go deep it those bit values, but what i understood was

1. 0 or positive number indicates sucess

2. negative number will indicate failure

My Scenario, I have the following structure

Code:

struct NODE
{
NODE* pLeft;
NODE* pRight;
}

Now I want to write a function with following signature

Code:

HRESULT TreeHasDepth(NODE* pNode, int depth)
{
// my code here
}

In above function,

1. if depth of tree is equal to the given value of depth passed

2. if depth of tree is greater than the given argument passed

3. if depth is less than the given value of integer passed

4. if the tree is null

For the above scenarios to be tested, probably we will have to override HRESULT, can someone help me to understand how can we do it ?

Any help is greatly appreciated.

Regards,

Ved