I'm stuck with code shown in refrence link How to write C functions that modify head pointer of a Linked List?
Code:
voidpush_front(Node** head, int new_val){
Node* new_node = newNode(new_val);
new_node->next = (*head);
*head = new_node;
}
intmain(){
Node *head = NULL;
push_front(&head, 2);
}
Pointer hold memory location of other variable and we can obtain the value pointed by pointer using derefrencing
In code, function create new node I don't understand these two lines in code what does new node point in list and how does it point
Code:
new_node->next = (*head);
*head = new_node;