/*****************************************************************
 * This program initializes an array in descending order and     *
 * uses the bubble sort algorithm to sort the array in ascending *
 * order. Array size is given as input to the program.           *
 *****************************************************************/
#include        <stdio.h>
#include        <time.h>

#define ARRAY_SIZE   8000

extern void bubble_sort (int*, int);

int main(void)
{
	clock_t start, finish;
	int value[ARRAY_SIZE];
	int i, size;
	printf ("Please input the array size: ");
	scanf("%d", &size);

	/* initialize the array in descending order */
	for (i=0; i<size;i++)
	    value[i] = size-i;

	start = clock();
	bubble_sort (value, size);
	finish = clock();
	printf("Sorting took %f seconds to finish.\n", 
		((double)(finish-start))/ CLOCKS_PER_SEC);
	
	return 0;
}
