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;
}
Name:
Anonymous2008-05-15 14:18
>>17
doesn't work if you store the result of compose in a variable, change f, and then try to call your "composed" function. >>1 does.