int main(){
int n = arc4random() % 64;
int f(int n){
return n << 1;
}
printf("f(%d) = %d\n", n, f(n));
printf("f(f(%d)) = %d\n", n, f(f(n)));
composed_func c;
compose(f, f, &c);
printf("compose(f,f)(%d) = %d\n", n, c.call(n));
return 0;
}
>>24
I think I understand now. If the f you are refering to is a local function pointer, then >>17 won't even compile, since nested functions can not refer to local variables of the enclosing function.