Ok... yes, the head is the first in the list.
So once I have set the head to the adress of the SL.head, and now I need to traverse the list and actually copy the nodes
Code:
while(pCur->next != NULL)
{
pCur = pCur->next; // ok, so this traverses the list
// but it still references the address of the original node (SL)
// so calling any function, that mods the list, at this point
// would affect the SL list, right? So what's next? a new pointer?
}
So I need something that keeps track of the last node, traverses the SL list, and something that creates the new nodes
Code:
Node *pPrev;
Node *pCur;
Node *pSL;
head = SL.head;
pPrev = head;
pSL = SL.head->next;
while(pSL != NULL)
{
pCur = new Node;
pCur->data = pSL->data;
pPrev->next = pCur;
pSL = pSL->next;
pPrev = pCur;
}
This makes somewhat of a sense to me to, I guess am I waaay of the target? And thank's again
