标签:ret 选择排序 include printf int sort sel void for
#include <stdio.h>
void Simple_Select_Sort(int *Array,int length)
{
int i,j,min,temp;
for(i = 0; i < length; i++)
{
min = i;
for(j = i+1; j < length; j++)
{
if(Array[min] > Array[j])
{
min = j;
}
}
if(min != i)
{
temp = Array[min];
Array[min] = Array[i];
Array[i] = temp;
}
}
for(i = 0; i <length; i++)
{
printf("%d\n",Array[i]);
}
}
int main(void)
{
int cnt ;
int Array_Test[] = {2,4,5,1,3,8,6,7,9,0};
Simple_Select_Sort(Array_Test,10);
return 0;
}
标签:ret 选择排序 include printf int sort sel void for
原文地址:https://www.cnblogs.com/muzixiaofeng/p/10088611.html