This topic is now archived and is closed to further replies.

Function pointer array

This topic is 5777 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I've been learning how to declare function pointers and I want to know how can I declare an array of function pointers, i.e.: typedef VOID (*TFunc)(WORD, WORD, LONG, LONG); TFunc Functions[12]; is it possible to do? thnx. Please lay off the caps in your topic titles, yelling won't get your questions answered any faster. Thanks. -fel Edited by - felisandria on February 21, 2002 10:33:47 AM

Share this post

Link to post
Share on other sites
Original post by Draxis
Yep, that''s possible.
Though I dunno why you''d want to make an array filled with the same function like that.

It doesn''t have to be the same function, you just need to ensure the functions have the same signature. An example of where it would be useful is in something resembling the observer design pattern, where a number of functions register their interest in being notified of callback events.

The placement of a donkey''s eyes in its head enables it to see all four feet at all times.

Share this post

Link to post
Share on other sites