Function pointer array

Started by
3 comments, last by Lestat3D 22 years, 2 months ago
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
Advertisement
Yep you can create arrays of any types, including function pointers.

- Pete
Yep, that''s possible.
Though I dunno why you''d want to make an array filled with the same function like that.
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.
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.

This topic is closed to new replies.

Advertisement