Question

For a non-empty linked list, select the code that should appear in a function that adds a node to the end of the list. newPtris a pointer to the new node to be added, and lastPtris a pointer to the current last node. Each node contains a pointer nextPtr, a link to a node.
(a)
lastPtr->nextPtr = newPtr;
lastPtr = newPtr;
(b)
lastPtr = newPtr;
lastPtr->nextPtr = newPtr;
(c)
newPtr->nextPtr = lastPtr;
lastPtr = newPtr;
(d)
lastPtr = newPtr;
newPtr->nextPtr = lastPtr;

Answer

This answer is hidden. It contains 3 characters.