Yes, that looks good.
As to sorting, you need an outer loop and an inner loop. In the outer loop, you just set up the pointer to the start of the list. In the inner loop, you swap items that are out of order and move to the next item. The inner loop ends when you have gone through the list completely. The outer loop ends when you haven't swapped anything [which means that all items are in order].
--
Mats