declaring a function whose arg is another function
declaring a function whose arg is another function
- Subject: declaring a function whose arg is another function
- From: Roland Silver <email@hidden>
- Date: Mon, 24 Sep 2007 05:29:18 -0600
I have a problem having to do with the right C-code for declaring and
calling a function which has another function as argument.
I've tried to find the answer in Harbison/Steele, without success.
Consider a function like foo:
void foo(int arg);
and another C-function, bar, that has as argument a function like
foo, and returns nothing.
Question 1: how do I declare bar? One of these ways?
void bar(void fcn(int));
void bar(void (*fcn)(int));
void bar(void (*fcn)());
Question 2: how do I call bar with foo as argument? Like one of these?
bar(foo);
bar(&foo)
Question 3: Is this the right list to post this kind of question? If
not, where?
-- Roland Silver <email@hidden>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden