tags:

views:

80

answers:

1

hello i am trying to sort a linked list when i sort it it works on visual studio but when i move it to linux the linked list does not get sorted for some reason. my sorts gets a pointer to a pointer of the list and this is my sort code: i call the function like this: SortQueue(&pprocessQueue, ProcessPrIdCompare); and here is my function the function uses EnqueueInOrder which puts every link in his place.

 void SortQueue(Queue **pqueue, CompareFunction CompareElements)
 {
   Queue *ptemp = CreateQueue( (*pqueue)->CopyElement, 
                               (*pqueue)->FreeElement,
                               CompareElements,
                               (*pqueue)->PrintElement );

   (*pqueue)->CompareElements = CompareElements;

   while (!(IsEmpty(*pqueue) == SUCCESS))
     EnqueueInOrder(ptemp, DequeueLink(*pqueue));

   while (!(IsEmpty(ptemp) == SUCCESS))
    EnqueueInOrder(*pqueue, DequeueLink(ptemp));

   FreeQueue(ptemp);
}

1 more thing i am using gcc to compile.

A: 

I don't see the problem with your code. It'll probably be wise to check the code that reposes outside of the code you've shown us.

Mr_Spock
i found out what my problem was ... i didnt use casting on the compare function defenition thx anyway
Nadav Stern