Problem understanding

I don’t quite get how result and last are connected. Why when we add Node address to it adds to result.

Type your question above this line.


result is the linked list that saves the sum in the same fashion as the addenda. last is the pointer that points to the last node of the result, much like integer1 and integer2 navigate through the linked lists to be added. As result is instantiated as an empty linked list (LinkedListNode* result = nullptr;), we need to create a new node pNew to add to the result and the variable last to remember the address of the last node of result.

1 Like

I see now, thank you!