Thread: How to use HRESULT in a function defined in C

  1. #1
    Registered User
    Join Date
    Apr 2013

    How to use HRESULT in a function defined in C

    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
    struct NODE
           NODE* pLeft;
           NODE* pRight;
    Now I want to write a function with following signature
    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.


  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Too many copies of the same question to care about.
    How to use HRESULT in C function
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to use HRESULT in C function
    By vedsharma in forum C Programming
    Replies: 7
    Last Post: 04-13-2013, 04:18 AM
  2. Replies: 35
    Last Post: 12-01-2011, 08:31 PM
  3. Error: _ defined as a function returning a function?
    By Jardon in forum C Programming
    Replies: 15
    Last Post: 07-29-2009, 11:53 AM
  4. Replies: 14
    Last Post: 03-02-2008, 01:27 PM
  5. Hresult
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 06-25-2002, 01:11 PM