https://leetcode.com/problems/delete-node-in-a-linked-list/
There is some mistake in code but I can't fix it. I am not good with pointers and structures. Can somebody point out the mistake?
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
void deleteNode(ListNode* &node) {
node = (node->next);
}
};