there is some problem in my code please help me to find it

Code:#include <stdio.h> #include <iostream> #include <stdlib.h> int c; void insertionsort(int x[],int length) { int key,i; for(int j=1;j<length;j++) { key=x[j]; i=j-1; while(x[i]>key && i>=0) { x[i+1]=x[i]; i--; } x[i+1]=key; } printf("After insertionsort: "); for(i = 0; i < 10; i++) { printf(" %d ", x[i]); } printf("\n"); } void recursive_quicksort(int arr[], int low, int high ) { int i = low; int j = high; /* compare value */ int z = arr[(low + high) / 2]; /* partition */ do { /* find member above ... */ while(arr[i] < z) i++; /* find element below ... */ while(arr[j] > z) j--; int y; if(i <= j) { /* swap two elements */ y = arr[i]; arr[i] = arr[j]; arr[j] = y; i++; j--; } } while(i <= j); /* recurse */ if(low < j) recursive_quicksort(arr, low, j); if(i < high) recursive_quicksort(arr, i, high); } void Swap(int x, int y){ int temp = x; x = y; y = temp; }//end swap void choosePivot(int theArray[], int first, int last){ int pivot; //find middle of array int middle = last - first; //compare first middle and last item in array if((first < last)&&(last > middle)){ if(first < middle){ //middle is median number pivot = middle; }else{ //first is median number pivot = first; } }else if((first < middle)&&(middle > last)){ if(first < last){ //last is median number pivot = last; }else{ //first is median number pivot = first; } }else{ if(last < middle){ //middle is median number pivot = middle; }else{ //last is median pivot = last; } } } void partition(int theArray[], int first, int last, int pivotIndex){ choosePivot(theArray, first, last); int pivot = theArray[first]; int lastS1 = first; int firstUnknown = first + 1; for(; firstUnknown <= last; ++firstUnknown){ if(theArray[firstUnknown] < pivot){ ++lastS1; Swap(theArray[firstUnknown], theArray[lastS1]); }//end if Swap(theArray[first], theArray[lastS1]); pivotIndex = lastS1; }// end partition } void quicksort(int theArray[], int first, int last){ int pivotIndex; if(first < last){ //create the partition: S1, pivot, S2 partition(theArray, first, last, pivotIndex); } } int main(void) { int array[10] ; int i = 0; for(i = 0; i < 10; i++) array[i] = rand() % 100; int ch; printf("\n\t***** MAIN MENU *****\n"); printf("\n1. insertion sort\n"); printf("\n2. recursive quick sort\n"); printf("\n3. non_recursive quick sort\n"); printf("\n4. Exit Program"); printf("\n----------------------------------"); printf("\nSelect any one of the above==>"); scanf("%d",&ch); /* print the original array */ switch(ch){ case 1: printf("Before sorting the array: "); for(i = 0; i < 10; i++) { printf(" %d ", array[i]); } printf("\n"); insertionsort(array, 10); break; case 2: printf("Before sorting the array: "); for(i = 0; i < 10; i++) { printf(" %d ", array[i]); } printf("\n"); recursive_quicksort(array, 0, (10 - 1)); printf("After non_recursive quicksort: "); for( i = 0; i < 10; i++) { printf(" %d ", array[i]); } printf("\n"); break; case 3: printf("Before sorting the array: "); for(i = 0; i < 10; i++) { printf(" %d ", array[i]); } printf("\n"); quicksort(array,0,9); break; case 4: printf("you are out of the menue"); } c=getchar(); return 0; }