int a[10] = {6,8,7,9,0,1,3,2,4,5};
int *b;
int count = 0;
b = calloc(4*10,1);
while(count < 10)
{
int c = INT_MAX;
for(int i=1;i<10;i++)
{
if(a[i] < c)
{
c = a[i];
}
if(c == count)break;
}
b[count] = c;
count++;
}
结果:b = {0,1,2,3,4,5,6,7,8,9}