C programming Linked Lists delete node at position N

前端 未结 5 561
猫巷女王i
猫巷女王i 2020-12-18 08:16

EDIT: Figured out the problem. Also if you found this through google or another search engine here is where I went wrong and how to fix it.

My delet

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-18 08:55

    Your DeleteNode doesn't delete a node, it removes pos nodes from the front of the list. So you're trying to remove 9 items from a list that only contains 6, resulting of course in an empty list (NULL). Also, your code is overly complex and contains remnants of previous attempts. Please don't do that to yourself or to us; provide simple clean code and it will be easier to understand and to fix.

提交回复
热议问题