#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

/*bubble sort function*/
void bubble_sort(unsigned char *p, int len)
{
	int i,j;
	unsigned char tmp;
	
	for (i=0;i<len-1;i++) 
	{
		for (j=0;j<len-i-1;j++) 
		{
			if (p[j] < p[j+1]) 
			{
				tmp = p[j];
				p[j] = p[j+1];
				p[j+1] = tmp;
			}
		}
	}
}

/*main procedure*/
void main()
{
	unsigned char test[] = {4,3,8,2,9,7,1,5,0,6};
	int len = sizeof(test);
	int i;
	
	bubble_sort(test, len);
	
	printf("result:\n");
	for (i=0;i<len;i++)
	{
		printf("%d ",test[i]);
	}
}
