#include <iostream>
using namespace std;

int f1(int value)
{
  return 2 * value;
}

int f2(int value)
{
  return 3 * value;
}

void m(int t[], int size, int f(int))
{
  for (int i = 0; i < size; i++)
    t[i] = f(t[i]);
}

int main()
{
  int list1[] = {1, 2, 3, 4};
  m(list1, 4, *f1);
  for (int i = 0; i < 4; i++)
    cout << list1[i] << " ";
  cout << endl;

  int list2[] = {1, 2, 3, 4};
  m(list2, 4, f2);
  for (int i = 0; i < 4; i++)
    cout << list2[i] << " ";
    cout << endl;

  return 0;
}