#include #include using namespace std; void f00(); void f01(); void f02(); void f10(); void f11(); void f12(); int main() { const size_t xmax = 3; void (*const a[][xmax])() = { {f00, f01, f02}, //or &f00 with explicit "address of" operator {f10, f11, f12} }; const size_t ymax = sizeof a / sizeof a[0]; size_t x; //uninitialized variable cin >> x; if (x >= xmax) { cerr << "x value " << x << " must be in the range 0 to " << xmax - 1 << " inclusive\n"; return EXIT_FAILURE; } size_t y; //uninitialized variable cin >> y; if (y >= ymax) { cerr << "y value " << y << " must be in the range 0 to " << ymax - 1 << " inclusive\n"; return EXIT_FAILURE; } a[y][x](); //or (*a[y][x])() with explicit dereferencing operator return EXIT_SUCCESS; }