void recordenen(int array[],int length)
{
int *start=array;
int *end=array+length-1;
while (start<end)
{
while(start<end&&((*start)%2!=0))
start++;
while(start<end&&((*end)%2==0))
end--;
if(start<end)
{
int temp=*start;
*start=*end;
*end=temp;
}
}
}
调整数组顺序使奇数位于所有偶数前面
最新推荐文章于 2023-04-11 18:14:39 发布