Inserting at specific location in singly linked list. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Inserting at specific location in singly linked list.

In this code inserta() function is working but after that if we try to implement display() function the output is going in infinite loop. Other functions insertb() and inserte() are working fine with display (). https://code.sololearn.com/cVWClPYTz4uT/?ref=app

27th Oct 2018, 10:18 PM
harshit
harshit - avatar
2 Answers
+ 3
inserta will fail if you try to insert after first as ptr1 still points to the first node so the first two have a circular loop and the rest of the list is lost.
28th Oct 2018, 3:04 AM
John Wells
John Wells - avatar
0
John Wells please take a look at this code.
27th Oct 2018, 10:19 PM
harshit
harshit - avatar