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; }
Insufficient code to determine the problem. Create a minimal testbed that defines Node, and sets up a main function that initialises the smallest possible numberr of Node variables to reproduce the problem, and call Check_CreateNumberNode from that main function. Then post the complete code.
i was suspecting the problem is with this functon only, but it turned out there was no probs..its my mistake only...