【leetcode】按奇偶排序数组

 

 

int Mycmp(const void* a,const void* b)
{
    return *(int*)a % 2 - *(int*)b % 2;
}
int* sortArrayByParity(int* A, int ASize, int* returnSize){
    qsort(A,ASize,sizeof(int),Mycmp);
    *returnSize = ASize;
    return A;
}

 

posted @ 2020-09-05 15:14  温暖了寂寞  阅读(116)  评论(0编辑  收藏  举报