Complete the AddToEnd() function
Insert a node that stores data at the end of the list. The traversal of the linked list to get to the end has already been written for you.
- In List.cpp, edit List::AddToEnd(int data).
- Implement the pointer logic in the section of code labeled
"PUT CODE HERE". For example, suppose the linked list is
m_head -> dummy -> 1 -> 4 -> 5 -> 7 -> 8 -> NULLand you want to add 6. current would already be pointing to the 8: your job is to allocate a new Node from the heap, initialize it, and insert it into the list after the 8 so that the list looks like
m_head -> dummy -> 1 -> 4 -> 5 -> 7 -> 8 -> 6 -> NULL