Pointers to functions

Jul 17, 2009 at 9:02pm
Hey all, In my C++ class we are to create a function that will basically take in a function of any type and integrate it.

I was wondering if anyone would be able to tell me how to use pointers to functions? Any help is greatly appreciated.
Jul 18, 2009 at 1:01am
By "integrate" what do you mean? Compute the integral? That has nothing to do with pointers to functions. If so, that is no simple task for any arbitrary mathematical function.
Jul 18, 2009 at 2:02am
basically compute the intergral from a to b ( a and b would be paramaters along with the function). Its to show that you can create a pointer to a function like in this case when u dont know if you are going to compute sin() or something different.

Sorry if it's kinda vauge. Im not to worried about the assignemnt itself I jsut want to learn the concept of a pointer to a function.
Jul 18, 2009 at 2:42am
basically it has the following format
return_type (*ptr_name)(input_type...)=function name

and then to call it (*ptr_name) (var1...);

here is a decent tut
http://www.newty.de/fpt/index.html
Jul 18, 2009 at 1:47pm
I'm thinking that you aren't fully understanding the assignment. Can you post the assignment question?
Topic archived. No new replies allowed.