While The insertathead function goes in the first if Condition

While The insertathead function goes in the first if Condition why are not we passing the head pointer by reference again?

@JaveedYara if (head == NULL) means that the linked list is empty, so any insertion will automatically be at head only. if p== 0 this means that we WANT to insert at head.
This is why insertathead() goes in the first if condition.

We are passing “head” by reference only.

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

1 Like