1 #include<stdio.h>
2 int a[] = {23,46,0,8,11,18};
3 void qsort(int left,int right){
4 if(left>=right){
5 return;
6 }
7 int i = left;
8 int j = right;
9 int key = a[i];
10 while(i<j){
11 while(i<j&&a[j]>key){
12 j--;
13 }
14 a[i] = a[j];
15 while(i<j&&a[i]<key){
16 i++;
17 }
18 a[j] = a[i];
19 }
20 a[i] = key;
21 qsort(left,i-1);
22 qsort(i+1,right);
23 }
24 int main(){
25 qsort(0,5);
26 int i=0;
27 for(;i<6;i++){
28 printf("%d
",a[i]);
29 }
30 return 0;
31 }