Insertion in linked list

void insertAtmiddle(node*&head ,int d , int l){
if(head==NULL){
insertAtHead(head , 8);}
// node* ptr = head;
while(head->data != l || head->next!= NULL ){
head = head->next;
}
node *n = new node(d);
n->next = head->next;
head = n;
}

sir i have wrote this funtion for insertion in middle but after calling this funtion if i am calling print function then it is not printing anything please tell me what is the error.

hi @anjalipal2102003_eabe4f91da0a918f send the complete code on ide.codingblocks.com

  1. login
  2. copy paste complete code
  3. save (ctrl + s)
  4. send the url of the page

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.