Hello,
I looked at your code, and it appears to be a bubble-sort. Here is what I would do.
1) Get yourself a nice sheet of paper, and a pencil.
2) Draw out your data structure.
[CODE]
+-------+ +------------------+ +------------------+
| head | | data | point | | data | point |
+-------+ +------------------+ +------------------+
[\CODE]
Remember to draw little boxes for the temp pointers and stuff too.
3) Go through your code by hand, and fill in the paper as the computer would during the iterations. Do not assume when doing this by hand. Go through the motions, and stick with it. You will find your error.
4) In my coding days, I was always sure to make a duplicate head pointer, just in case I messed up the transition somewhere. Guess it was mild parinoia.
Christian