#include "stdafx.h" bool isEven(int n) { return (n&1) == 0; } void reorder(int * arr, int len) { int * begin = arr; int * end = arr+len-1; while(true) { while(!isEven(*begin)) { begin++; } while(isEven(*end)) { end--; } if(begin<end) { int temp = *begin; *begin = *end; *end = temp; } else { break; } } } int _tmain(int argc, _TCHAR* argv[]) { int arr[10] = {1,3,5,7,9,2,4,6,8,11}; reorder(arr,10); return 0; }