Code:
#include "stdafx.h"
#include <iostream>
using namespace std;
bool isOdd(const int* item)
{
return (*item)%2;
}
int deleteItems (int *array, int itemSize, int itemsCount, bool (*shouldDeleteItem)(const int*))
{
for(int i=0; i<itemsCount; i++)
cout<< shouldDeleteItem (array+i)<< endl;
return itemsCount*itemSize;
}
void main()
{
int *p = NULL;
int n;
cout<< "Enter length of array: ";
cin>> n;
p = new int [n];
cout<< "Numbers in the array: ";
for(int i=0; i<n; i++)
cin>> *(p+i);
for(int i=0; i<n; i++)
{
deleteItems(p, sizeof(p+i), n, isOdd(p+i));
}
}
