/* * Looking at pointers to functions * * int *p; # p is pointer to int * (int *)p; # same * int* p; # same * * int **(***f)(int**, int); # very ugly but syntax OK * f is a pointer to a pointer to a pointer to * a function which returns a pointer to a pointer to * an int and which takes two arguments, one of which * is a pointer to a pointer to an int, and one of * which is an int */ #include // a function int f1(int i, int j){ return 2*i + j; } int f2(int i, int j){ return i + 3*j; } void doit_print(int (*func)(int, int), int a, int b){ int answer = (*func)(a,b); printf(" the answer is %b\n", answer); } int main(){ doit_print(&f1, 3, 4); // f1(3,4) and print output doit_print(&f2, 3, 4); return 0; }