Problems with Quicksort and Pointers

So, here's what's my program is supposed to be doing in a nutshell:

> First it opens a file, and each time a set of 4 numbers is read (4 numbers representing points of a rectangle) and stored unsorted in a double-linked list, until the file is read.

> Then the list is sorted using each dimension, so first the x-min, then y-min, x-max and y-max. The original order of the double-list must not be changed, so a list (using only the pointers) for each dimension is created.

My problem is with the quicksort, I have created a quicksort but it's not working correctly, I've been trying to fix it with debugging but even that is crashing, any help? Currently I am using bubblesort but obviously it is super-slow!

Any help with the quicksort function please?

The function is this:

Code:

`void quickSort(struct nodes *left, struct nodes *right, int which)`

Thanks.