Bubble Sort

The source code for bubble sort.

#include #define NUM 6 void swap(int arr[], int i, int j) { int tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp; } main() { int arr[NUM],i,j; // start reading nums for(i=0;i arr[j+1]) swap(arr,j,j+1); // print sorted arr for(i=0;i

Please point your web links to this page if you use this code for any purpose.

Leave a Reply

Your email address will not be published. Required fields are marked *