【leetcode】反转链表

struct ListNode* reverseList(struct ListNode* head){
    
    struct ListNode*p = NULL;
    struct ListNode*pre = NULL;

    while(head!=NULL)
    {
        p = head->next;
        head->next = pre;
        pre = head;
        head = p;
    }
    return pre;
}
原文地址:https://www.cnblogs.com/ganxiang/p/13543861.html