Quicksort difficulties

I've tried to programming Quicksort several times but even during my class at school to trying to setup netbeans at home, I can't get it to run. My teacher has a large class so while we're close he can't help me and teach the lower level class learning java. I don't understand what's wrong with the following code.

#include <cstdlib>

using namespace std;

void quickSort(int arr[], int left, int right);

int main(int argc, char** argv) {

int array[]={9,8,7,6,5,4,3,2,1};

quickSort(array,0,9);

for(int counter=0; counter<9; counter++){

array[counter];

}

return 0;

}

void quickSort(int arr[], int left, int right) {

int i = left, j = right;

int tmp;

int pivot = arr[(left + right) / 2];

while (i <= j) {

while (arr[i] < pivot)

i++;

while (arr[j] > pivot)

j--;

if (i <= j) {

tmp = arr[i];

arr[i] = arr[j];

arr[j] = tmp;

i++;

j--;

}

};

if (left < j)

quickSort(arr, left, j);

if (i < right)

quickSort(arr, i, right);

}
it works, you just didn't output it to the console/command line

1
2
3
for(int counter=0; counter<9; counter++){
    array[counter]; //<----your compiler should give a warning here!
}
I used codepad.org due to compiler issues and I got this after adding cout to array[counter]; by the above user.
Disallowed system call: SYS_socketcall
Topic archived. No new replies allowed.