If you write:
Node *cur = head;
cur = NULL;
then cur will be pointing to nothing and nothing will happen to head.
If you write:
Node *cur = head;
cur = cur->next;
cur = NULL;
The same thing will happen (cur will be pointing to nothing and nothing will happen to head) unless head was NULL, in which case, you'll crash on cur = cur->next;
If you're trying to set head->next to NULL via the cur pointer, you can do so with the following:
Node *cur = head;
cur->next = NULL;
I can see your confusion is coming from the nature of pointers. When you say Node *cur = head; you are creating a Node pointer that points to the same memory address as head. If you set cur to something else via cur = NULL, then you're only changing what cur points to, not the value of what it's pointing to and therefore, head is left alone.
When you use cur->next = NULL instead, you're modifying the next member of what cur points to. This is also the next member of what head points to and therefore, the change is also reflected in head->next.
int x = 0; int y = x; y = 1;. Why doesn't the value ofxchange when we assign toy?