#include <stdio.h>
typedef int(*sort_func)(int, int);

void bubble_sort(int arr[], int len,sort_func test)
{
	int temp;
	for (int i = 0; i < len-1; i++)
	{
		for (int j = 0; j < (len - i) - 1; j++)
		{
			if (test(arr[j], arr[j+1]))
			{
				temp = arr[j];
				arr[j] = arr[j + 1];
				arr[j + 1] = temp;
			}
		}
	}
}

int case1(int n1, int n2)
{
	if (n1 > n2)
		return 1;
	else
		return 0;
}
int case2(int n1, int n2)
{
	if (n1 < n2)
		return 1;
	else
		return 0;
}


int main()
{
	int arr1[10] = { 3,5,1,2,5,8,3,2,5,7 };
	bubble_sort(arr1, sizeof(arr1) / sizeof(int),case1);
	for (int i = 0; i < sizeof(arr1) / sizeof(int); i++)
	{
		printf("%d ", arr1[i]);
	}

	return 0;
}