You are viewing a single comment's thread. Return to all comments →
You aren't freeing the dynamically allocated newNode and also head when position is 0.
free
head
0
Seems like cookies are disabled on this browser, please enable them to open this website
Insert a node at a specific position in a linked list
You are viewing a single comment's thread. Return to all comments →
You aren't
free
ing the dynamically allocated newNode and alsohead
when position is0
.