|
-
Feb 6th, 2002, 08:32 PM
#1
Thread Starter
Addicted Member
sort problem
I am trying to sort a linked list alphabetically as the values come in, but it is totally not working, when I do the print out it is not sorting them at all, here is what I am doing:
<code>
if(head == NULL){/*nothing in the list*/
head = File;
end = head;
head->prev = NULL;
head->next = NULL;
}
else{/*there is something in the list*/
temp1 = end;
do{
if((strcmp(File->filename, temp1->filename)) > 0){
File->prev = temp1->prev;
temp1->prev = File;
File->next = temp1;
}
}while((temp1= temp1->next) != NULL);
</code>
File is the link that I am trying to enter into the list. and head and end are two global pointers
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|