//bubble sort in C
//a is an array and q is its length
for(int i = 0; i<q; i++){
for(int j = 0; j<q-1; j++){
if(a[j]>a[j+1]){
a[j] ^= a[j+1];
a[j+1] ^= a[j];
a[j] ^= a[j+1];
}
}
}