pointers to functions

Paul Condie pjc at ptsfa.UUCP
Fri Jul 4 07:22:06 AEST 1986


Example of pointers to functtions:

#include <stdio.h>
typedef int FCH();
typedef FCH *pFCH;

main()
{
   int   	Function1(), Function2(), Function3();
   static pFCH	Farray[]= { Function1, Function2, Function3 };

   (*Farray[0])();
   (*Farray[1])();
   (*Farray[2])();
}

Function1()
{   printf ("\nExecuting function 1"); }

Function2()
{   printf ("\nExecuting function 2"); }

Function3()
{   printf ("\nExecuting Function 3"); }

/* 
** Paul J. Condie
** 415/545-8371
** {ihnp4,qantel}!ptsfa!pbbahd!pbpjc!pjc
*/



More information about the Comp.lang.c mailing list