编辑代码

#include <stdio.h>

struct ListNode {
	int val;
	struct ListNode *next;
};

struct ListNode* ReverseList(struct ListNode *pHead) {
    struct ListNode *pre = NULL;
    struct ListNode *self = pHead;
    struct ListNode *next = NULL;
    while(self) {
        next = self->next;
        self->next = pre;
        pre = self;
        self = next;
    }
    return pre;
}
int main() {
    
}