求大神給個單鏈表的就地逆置 要不開拓輔助空間 原諒我沒有C幣
struct Node{
int value;
Node *next;
};
void reverse(Node* head){
Node *prev, *cur, *next;
cur = head;
prev = NULL;
while(cur != NULL){
next = cur->next;
cur->next = prev;
prev = cur;
cur = next;
}
}