//大家写的时候可得注意,她会再给你一个int* sortArrayByParity(int* A, int ASize, int* returnSize){的函数,其实没啥用,只是在
//你调试的时候会一直抱一个错误,然后你就很难受。
/**
* Note: The returned array must be malloced, assume caller calls free().
*/
/**
* Note: The returned array must be malloced, assume caller calls free().
*/
int* sortArrayByParity(int* A, int ASize, int* returnSize){
int left = 0;
int right = ASize-1;
while(left < right)
{
while(left<right && A[left]%2 == 0)
left++;
while(left<right && A[right]%2 == 1)
right--;
if(left < right)
{
A[left]^=A[right];
A[right]^=A[left];
A[left]^=A[right];
}
}
*returnSize = ASize;
return A;
}