Code Snippets C

#include
int bubble(int x[],int n) {
int hold,a,pass,i,switched = 1;
for(pass = 0; pass < n-1 && switched == 1;pass++) {
switched=0;
for (a=0;a if (x[a]>x[a+1]) {
switched=1;
hold = x[a];
x[a] = x[a+1];
x[a+1]=hold;
}
}
return(0);
}
int main() {
int marks[10];
int i;
marks[0] = 39;
marks[1] = 55;
marks[2] = 43;
marks[2] = 43;
marks[3] = 49;
marks[4] = 12;
marks[5] = 2;
marks[6] = 5;
marks[7] = 4;
marks[8] = 3;
marks[9] = 1;
bubble(marks, 10);
for(i =0;i<10;i++){
printf("%d ",marks[i]);
}
}