• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
declaring a function whose arg is another function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: declaring a function whose arg is another function
      • From: Alastair Houghton <email@hidden>
  • Prev by Date: Re: Sort a NSArrayController using case-insensitive compare, possible ?
  • Next by Date: Closing application from NSStatusBar menu?
  • Previous by thread: Re: Core data or else?
  • Next by thread: Re: declaring a function whose arg is another function
  • Index(es):
    • Date
    • Thread