#include <stdio.h>
void select_sort(int array[],int n);
int main( )
{
int a[10]= {4,3,7,9,1,5,0,8,2,6},i;
select_sort(a,10);
printf("the sorted array:\n");
for(i=0; i<10; i++)
printf("%d ", a[i]);
printf("\n");
return 0;
}
void select_sort(int array[],int n)
{
int i,j,k,t;
for(i=0;i<n-1;i++)
{
k=i;
for(j=i+1;j<n;j++)
{
if(array[j]<array[k])
{
k=j;
}
}
t=array[k];
array[k]=array[i];
array[i]=t;
}
return;
}