#include <iostream>
#include <algorithm>
int main () {
int arr[] = {1, 3, 2, 5, 2, 6, 2, 2, 2};
int *end = arr + sizeof(arr) / sizeof(int);
int value = 2;
end = std::remove(arr, end, value);
for (int *p = arr; p != end; p++)
std::cout << *p << ' ';
return 0;
}
/*
run:
1 3 5 6
*/