Skip to content

Instantly share code, notes, and snippets.

@ryuichimatsumoto-single
Created July 5, 2012 08:40
Show Gist options
  • Save ryuichimatsumoto-single/3052341 to your computer and use it in GitHub Desktop.
Save ryuichimatsumoto-single/3052341 to your computer and use it in GitHub Desktop.
function_bubble_sort
void bubble_sort(int a[],int n)
{
int i;//ループ用変数
int j;//ループ用変数
int tmp;//交換用変数
for(i=0;i<n;i++){
for(j=(n-1);j>i;j--){
if(a[j-1] > a[j]){
tmp = a[j];
a[j] = a[j-1];
a[j-1] = tmp;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment