Hello everyone,

my Prof. wrote a quicksort source code on the board. We have to implement it in another program. The problem is, the quicksort function raises an exception. I've spent lots of hours to find the error but I still don't know what's wrong.

I am nearly convinced that the Prof. made a mistake ...

Anyway, here is the source code:

Thank you for your help.Code:void quick(int array[], int l, int r) { int cut; if(l < r) { cut = partition(array, l, r); quick(array, l, cut); quick(array, cut, r); } } int partition(int array[], int l, int r) { int i, j, pivot, tmp; i = l-1; j = r+1; pivot = array[l]; while(i < j) { while(array[++i] < pivot); while(array[--j] > pivot); if(i < j) { tmp = array[i]; array[i] = array[j]; array[j] = tmp; } } return j; }