Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > calling a function via a pointer-to-function

Reply
Thread Tools

calling a function via a pointer-to-function

 
 
NoWonder
Guest
Posts: n/a
 
      04-09-2005
WHO can tell me how can i the structural things about calling a function
via a pointer-to-function?
thank you.


 
Reply With Quote
 
 
 
 
Matthias Kaeppler
Guest
Posts: n/a
 
      04-09-2005
NoWonder wrote:
> WHO can tell me how can i the structural things about calling a function
> via a pointer-to-function?
> thank you.
>
>


Just like any other function:

void foo( void (*f)() )
{
f();
}

--
Matthias Kaeppler
 
Reply With Quote
 
 
 
 
Matthias Kaeppler
Guest
Posts: n/a
 
      04-09-2005
Matthias Kaeppler wrote:
> Just like any other function:
>
> void foo( void (*f)() )
> {
> f();
> }
>


Or even more human readable:

void foo( void f() )
{
f();
}

I think this is the same, but more intuitive to read. Does someone know
if this is a historical thing? Maybe the latter is only allowed in C++,
while the former is allowed in C as well as C++?

--
Matthias Kaeppler
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XML page on IE & Flash calling javascript function via getURL piotr.sadowski Javascript 0 07-02-2008 08:22 AM
write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function parameter komal C++ 6 01-25-2005 11:13 AM
calling virtual function results in calling function of base class... Andreas Lagemann C++ 8 01-10-2005 11:03 PM
calling virtual function results in calling function of base class ... tiwy C++ 0 01-09-2005 11:17 PM
Calling a global function with the same name as a member function anoopsaha@gmail.com C++ 5 01-05-2005 09:40 AM



Advertisments