What does this line of code do in words?
temp-> next-> prev = temp
Kinda confused.
temp-> next-> prev = temp
It is telling us to move the node one step forward, then one step backward. Then you assign temp to the node itself.
temp->next-> prev = temp
temp->next
gives us the next node in the list after temp.
temp->next->prev
gives us the previous pointer of the next node in the list after temp.
So the whole thing means: Assign temp to the previous pointer of the next node in the list after temp.