can someone give me an idea how i will create a sorting function for the linked list.. m pasting the code for my insert function of the linked list. i just want to know the logic of how i will sort the numbers as the user enters them.
thanks..
Code:void insert (struct node**start, int value) { if ((*start)== NULL) { *start= (struct node*) malloc(sizeof(struct node)); (*start)-> value = value; (*start)->next = NULL; }else { struct node*temp = *start; while ((temp->next)!= NULL) { temp= temp->next; } temp->next = (struct node*) malloc(sizeof(struct node)); temp->value = value; temp = temp->next; temp->next=NULL; } }



LinkBack URL
About LinkBacks




Makes my code look longer.