// bubble sorting an array #include // print the contents of an array of integers: void printarray(int A[], int n) { int i; for(i=0;iA[i+1]) { temp = A[i]; A[i] = A[i+1]; A[i+1] = temp; } // if i++; } // while } // ordswitch // After the n'th call to ordswitch, the nth largest number will be moved // to the right place. // So we call ordswitch size-1 times to sort array void bubblesort(int A[], int size) { int i; for(i=0;iA[j+1]) { temp = A[j]; A[j] = A[j+1]; A[j+1] = temp; } // if } // inner for j // size--; printarray(A,size); } // outer for i } // bsort2 int main() { int i; int B[7] = {8,4,6,2,4,11,7}; int C[7] = {7,6,5,4,3,2,1}; printarray(C,7); bsort2(C,7); return 0; } // main