Hey guys! I Need some help adding a basic bubble sort to this code so it sorts from small to large.
I need to add it where it says /* Bubble Sort Code */
Code:
Thanks!!
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define MAX 10
int a[MAX];
int main()
{
// seed PRNG
srand(time(NULL));
int i, t, x, y;
printf("The unsorted array:\n");
for (i=0; i < MAX; i++)
{
a[i] = rand() % 1024; // pick pseudorandom numbers between [0] and [1023]
printf("%d\n", a[i]);
}
/* Bubble Sort Code */
return 0;
}