BUBBLE SORTING USING C CODE


/*
bubblesort ported to c by
Jeffrin Jose T <ahiliation@yahoo.co.in>

from bubble.php by

detour@metalshell.com
License : GPL.
*/
#include<stdio.h>
#include<stdlib.h>

main()
{
int array_size=400;
int ran[1000];
int x,y,hold;
for(x = 0; x < array_size; x++)
ran[x]= rand();

for(x = 0; x < array_size; x++) {
for(y = 0; y < array_size; y++) {
if(ran[x] < ran[y]) {
hold = ran[x];
ran[x] = ran[y];
ran[y] = hold;
}
}
}
/* for(x = 0; x < array_size; x++)
printf("\n %d \n",ran[x]); */
}
, ,

%d bloggers like this: