DEV Community

Discussion on: Finally, a post on singly linked list I understand

Collapse
 
saral profile image
Saral Karki

Thank you so much for taking the time to go through the code and for the feedback.
I definitely see the point you make about the head, and it makes a lot of sense.

As for the while loop on the insert, there is no use for *P, and I don't know why I put it there.

Collapse
 
wiz profile image
wiz

Plus you can also try double pointers i.e passing a double pointer to head to the functions and abstain from returning head to update the actual head :)