Mail Archives: djgpp/1997/09/01/01:19:41
Jason Meehan wrote:
> How would I declare An array of A function?
> Thanks.
In C there's no such concept as an array of functions, but you can
declare (and use) an array of _pointers_ to functions:
extern int f(void), g(void), h(void);
extern int (*fa[])(void) = { f, g, h };
int i, ret;
for (i = 0; i < sizeof fa/sizeof fa[0]; i++)
ret = (*fa[i])(); /* or ret = (fa[i])(); */
--
Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
Alcyone Systems / http://www.alcyone.com/max/
San Jose, California, United States / icbm://37.20.07n/121.53.38w
\
"War is like love; / it always finds a way."
/ Bertolt Brecht
- Raw text -