in the insertAtHead function what does the head pointer stores when we do
n->next = head;
head = n;
does the head stores the value present in n or the address of n or the address of next node present in n
in the insertAtHead function what does the head pointer stores when we do
n->next = head;
head = n;
does the head stores the value present in n or the address of n or the address of next node present in n
@Manvik-Arya-4391661007540658 head just stores the address of first node of the linklist (points to it)
so if linklist is 2->3->4->5 where head points to 2 and there is n which points to 1
so 1->next = head which is 2 then head = 1
so 1->2->3->4->5 where head is 1
hope its clear if yes dont forget to hit like and mark resolved if cleared
but n is a pointer variable of type node so when we do head = n;
then it will give the address it is containing and not the value of n. Also please look at this head = 0xf67078 &head = 0x61fecc n = 0xf67078 &n = 0x61fe9c
yes whats the problem . head will now point to n which points toh first element of linklist ultimately head equals first element