My code is working fine but the first element is being printed twice. Please help where the problem is.
Linked List | First Element Printing Twice
@VarIsh hey Ishwar there is mistake in your insert function. I have modified your code here is your corrected code.
Please can you tell what was the problem?
@VarIsh your insertAtfunction was not right you have to return after creating new node like this
if(head==NULL){
head =new node(d);
return;
} but you returning in the bottom which is not a good idea to build a tail function
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.