#include /* two simple functions */ int add(int x, int y) { return x + y; } int mult(int x, int y) { return x * y; } int main() { /* a pointer to a function - notice the weird type declaration */ int (*fp)(int, int); /* point it at some function */ int operation; printf("Which operation?\n1 - add\n2 - mult\n: "); scanf("%d", &operation); if (operation == 1) { fp = &add; } else { fp = &mult; } /* now call the function through the pointer */ int result = fp(5, 7); printf("The result of your operation on 5 and 7 is: %d\n", result); return 0; }