If you used a std::vector instead of an array, you could #include <algorithm> and write:
Code:
even.erase(
std::remove_if(even.begin(), even.end(),
std::bind2nd(std::equal_to<int>(), 0)),
even.end());
At least assuming that you are dealing with ints. Of course, with an array you can still write:
Code:
// assuming even has not decayed into a pointer
int* even_end = even + sizeof(even) / sizeof(int);
even_end = std::remove_if(even, even_end, std::bind2nd(std::equal_to<int>(), 0));
Then you just use the range from even to even_end-1.