天天看點

【LeetCode】 237. Delete Node in a Linked List C語言

/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     struct ListNode *next;
 * };
 */
void deleteNode(struct ListNode* node) {
    //*node=*node->next;//一句話就可以搞定,後面的語句内容複制到前面去
    
    struct ListNode *next_node=node->next;
    node->val=next_node->val;
    node->next=next_node->next;
}
           

繼續閱讀