pointer to function with structure

Stanley Friesen friesen at psivax.UUCP
Tue Feb 5 03:26:14 AEST 1985


In article <9300002 at bradley.UUCP> brad at bradley.UUCP writes:
>I can't seem to get the hang of this one.  Anyone got anyideas on
>how to do it.  below is the code I thought would work but it doesn't.
>
>Basically what I want to do is to be able to insert the function into
>the structure and have it call that function.
>
>
>------------------------cut here------------------------
>		switch(gt[0]) {
>			case '1':
>				mesg[0].(*funcp)();
>				break;
>			case '2':
>				mesg[1].(*funcp)();
>				break;
>		}

	Here's your problem, this should be:

		switch(gt[0]) {
			case '1':
				(*mesg[0].funcp)();
				break;
			case '2':
				(*mesg[1].funcp)();
				break;
		}

-- 

				Sarima (Stanley Friesen)

{trwrb|allegra|cbosgd|hplabs|ihnp4|aero!uscvax!akgua}!sdcrdcf!psivax!friesen
 or
quad1!psivax!friesen



More information about the Comp.lang.c mailing list