Archived

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

Lestat3D

Function pointer array

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
Sure you can. Have you tried it? Are you having problems?

--
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
quote:
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