Hi i am getting a wierd output when i execute this function..Node is a structure
Head can be 1/0...if i give 1, its entering into if(Head == 1)..but then Head's value is changed to 1nNumber(12,13,...the second digit is nNumber). i suspect somehow the stack is getting curropted but not able to find out whr,how..
Code:
int Check_CreateNumberNode(const int Head,int nNumber,Node* pNode,Node** ppNode)
{
  int nRetVal=0;
  if(NULL == *ppNode)
  {
   return 1;
  }
  printf("\nCheck_CreateNumberNode");
  
  if(Head == 1)
  {
        (*ppNode)->Carry=0;
        (*ppNode)->Number=nNumber;
        (*ppNode)->pPrev=NULL;
        (*ppNode)->pNext=NULL; 
        printf("\nHead1=%d",Head);
  }else if(Head == 0)
  {
        (*ppNode)->Carry=0;
        (*ppNode)->Number=nNumber;
        (*ppNode)->pPrev=pNode;
        (pNode)->pNext=(Node*)*ppNode;
        (*ppNode)->pNext=NULL;  
        printf("\nHead0=%d",Head);
  }


  return nRetVal;
}

Last edited by shabbir; 4Nov2009 at 09:56.. Reason: Code blocks