jeudi 6 mars 2014

C: Why doesn't my code work when I want to append something to be head of the linked list?


Vote count:

0





void addToHead(Node * list, Node added)
{
//Where NodePointer is a typedef of a pointer to a node

(*added).next = (*list);
(*list) = added; //Set list pointer back to first entry
}


For some reason, I'm having issues with this. Why doesn't it work? I thought adding a pointer to a pointer will allow me to change the address of a pointer (as I did with Node * list)



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire