I'm having trouble completing the function void list::displayReverse() which basically displays the elements in the linked list in reverse. I have tried every possible way but it just doesn't seem to work. The function is associated with the struct
@wizard25
This is one problem that you really must solve yourself. Hints only go so far here. The best one so far is that you must "change the arrow direction".
Example, given:
node0 node1--> node2
and considering node1, we want to change node1's pointer to go to node0 instead of node2.
node0 <--node1 node2
You will have to traverse the list and remember the previous node's address for each step in your loop. This means that at each step you must know: the previous node's address, this node's address, and the next node's address. Figure out how these three values relate to each other each time you go to the next node and you'll have figured it out. Be sure to use pencil and paper.