Simplest will be bubble sort.
item* sort(item *start){
item *node1,*node2;
int temp;
for(node1 = start; node1!=NULL;node1=node1->next){
for(node2 = start; node2!=NULL;node2=node2->next){
if(node2->draw_number > node1->draw_number){
temp = node1->draw_number;
node1->draw_number = node2->draw_number;
node2->draw_number = temp;
}
}
}
return start;
}
1
solved Assorting linked list in c [duplicate]