Linked list sorting in C

前端 未结 5 811
自闭症患者
自闭症患者 2021-01-25 06:48

I\'m writing a simple file for one of my classes that is a simple linked list activity and I need to sort a linked list.

This is my source code so far:

/         


        
5条回答
  •  萌比男神i
    2021-01-25 07:44

    Rather than copy someone else's code that has known issues, I'd suggest making your own. You'll learn a lot more and just might end up with fewer bugs.

    That said, if you want to know what it's not working, follow through what happens once the smallest value reaches the head of the list. tmpPtr->value will get set to 1, which gets assigned to a, which ends up skipping the inner while loop.

提交回复
热议问题