下面的代码片段用于反转单链表,请进行( )修改,使其能正确实现相应功能。
1 ListNode* reverseLinkedList(ListNode* head) { 2 ListNode* prev = nullptr; 3 ListNode* current = head; 4 while (current != nullptr) { 5 ListNode* next = current->next; 6 current->next = next; 7 prev = current; 8 current = next; 9 } 10 return prev; 11 }