corey@fluke.UUCP (Corey Satten) (03/18/86)
I'm afraid it took me so long to reply to this message that I've
lost the original. I do remember that someone was complaining that
the Unix-PC 7300 C compiler did not work for arrays of pointers to functions.
The following small example demonstrates that (at least under rel 3.0)
the compiler does, in fact, work. The C declaration for array of pointer
to function is not very obvious, so I suspect that there is some
chance that the original poster didn't get the declaration right.
In any case, the following does work!
char *one() {return "one";}
char *two() {return "two";}
char *three() {return "three";}
/*
* declare foo as array of pointer to function returning pointer to char
*/
char* (*foo[])() = { one, two, three };
main() {
int i;
for (i=0; i<3; ++i) {
printf("%s\n", (*foo[i])()); /* prove that it works */
}
}
--
*******
Corey Satten; John Fluke Mfg. Co MS 223B; PO Box C9090 Everett WA 98206
{uw-beaver,decvax!microsoft,ucbvax!lbl-csam,allegra,tikal}!fluke!corey
(206) 356-5058