我试图弄清楚这种方法如何用于反转链表。但我只是不知道这里发生了什么。我需要知道它是如何将指针切换到另一个方向的。感谢帮助。
void reverse(struct node** head_ref)
{
Node* prev = NULL;
Node* current = *head_ref;
Node* next;
while (current != NULL)
{
next = current->next;
current->next = prev;
prev = current;
current = next;
}
*head_ref = prev;
}