#include #include #include void swap(int *xp, int *yp){ int temp = *xp; *xp = *yp; *yp = temp; }; // sort a given array arr[] with length n from least to greatest void bubbleSort(int arr[], int n){ int i, j; for (i = 0; i < n; i++){ for (j = 0; j < n - i - 1; j++){ // iterate through array 1 less slot each loop if (arr[j] > arr[j+1]){ // swap the largest number from left to right swap(&arr[j], &arr[j+1]); }; }; }; }; void printArray(int arr[], int size){ int i; for(i = 0; i < size; i++){ printf("%d ", arr[i]); }; }; //populate an array of a given length with randomly generated numbers void createArray(int arr[], int size){ int i; for(i=0; i