An array of function pointers.

John Antypas jantypas at ucrmath.UUCP
Fri Sep 16 02:56:40 AEST 1988


This may seem like a simple question but I've no luck with an answer so 
perhaps the net could help.  

In a graphics application we're writing at work, we have several functions for 
drawing lines, circles etc.  We'd like to set up something like a vector table.
If the vector table has a NULL in a spot, then the interpreter will use its
internal routines instead of faster device specific code.  As an example:

vectors[] =	{ dev_line(),
		  dev_box(),
		  dev_circle(),
		  dev_arc(),
		  dev_text()
		}

This says we have device specific code for all five functions.  Yet when I 
try to copy function addresses, the compiler complains.  How do I get the
address of a funciton and put it into an array for calling later?

Thanks.

John Antypas -- Soft21 --21st Century Software:
UUCP: {crash, garp, killer, pyramid, reed, ucsd!ucrmath}!soft21!jantypas
Internet: jantypas%soft21.uucp@{garp.MIT.EDU, ucsd.EDU}
Domains:  jantypas@{soft21.Riverside.CA.US, soft21.CTS.COM}



More information about the Comp.lang.c mailing list