I have rewritten my sort numerous times, but it doesn't work.
can anybody see why. I've asked this question numerous times, but noone has been able to point me in the correct direction. This below is my newest revision, but it still doesn't work. It hangs. I believe it hangs due to the red location.
prior thread on this question
Code:void linklist::orderedlist(linklist *list) { initializeData(); list->current=list->head; while (list->current != NULL) { current = previous = head; link* newlink = new link; strcpy(newlink->fname,list->current->fname); //hangs after this change was made. strcpy(newlink->lname,list->current->lname); strcpy(newlink->ssnumber,list->current->ssnumber); newlink->age=list->current->age; newlink->weight=list->current->weight; newlink->next = NULL; if (head == NULL) //this tells me I have an empty list { head = newlink; tail = head; } else { //find the position to insert it while ( strcmp(current->lname,buffer2)==1 && current->next !=NULL) { previous = current; current = current->next; } if (current==head)//it will become the new head { newlink->next=head; head=newlink; } else { if (current->next==NULL)//becomes the new tail { tail->next=newlink; tail = newlink; } else { previous->next=newlink; newlink->next=current; } } } } }