Skip to content

Instantly share code, notes, and snippets.

@metallurgix
Last active August 29, 2015 14:03
Show Gist options
  • Save metallurgix/adcdb870cb881abb5aec to your computer and use it in GitHub Desktop.
Save metallurgix/adcdb870cb881abb5aec to your computer and use it in GitHub Desktop.
Bubble Sort
void bubblesort (int *array, int len)
{
register int j, t=1;
while(len-- && swap)
{
for (j=swap=0; j<len-1; j++)
{
if (array[j]>aray[j+1])
{
swap=1;
t=array[j+1];
array[j+1]=aray[j];
array[j]=t;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment