试题与答案

方法void moveOddForward(int a[])的功能是将数组中的所有奇

题型:填空题

题目:

方法void moveOddForward(int a[])的功能是将数组中的所有奇数移到所有偶数之前。
void moveOddForward(int a[])
for(int i=0,odd=0;______;i++)
if(______)
int t=a[i];a[i]=a[odd];a[odd]=t;odd++;

答案:

参考答案:i<a.length
 a[i]%2==1

试题推荐
微信公众账号搜索答案