I am trying to add a node. Does this seem right??
LNode* AddItem(LNode *headPtr, int newItem)
auto struct LNode **nodePtr;
for (nodePtr = &LNode; *nodePtr != NULL; nodePtr = &(*nodePtr) -> next)
auto struct LNode *lPtr = *nodePtr;
if(newItem < lPtr ->value)
nodePtr = malloc(sizeof(LNode));
if (NULL == nodePtr)
printf("Error allocating memeory ");
nodePtr -> value = newItem;
nodePtr -> next = headPtr;
} // end of "AddItem"
C code again i would say, like your previous post? First finish with one function, i suggest this and then try to remove a node.See what ideas i gave you in your other post and try to take it step by step! ;)
This is supposed to be C++ right? Afterall, you've used the auto keyword.
Why are you using the struct keyword in there, and why is there a printf and a malloc call?