Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site psivax.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!houxm!vax135!cornell!uw-beaver!tektronix!decvax!ittvax!dcdwest!sdcsvax!sdcrdcf!psivax!friesen From: friesen@psivax.UUCP (Stanley Friesen) Newsgroups: net.lang.c Subject: Re: pointer to function with structure Message-ID: <300@psivax.UUCP> Date: Mon, 4-Feb-85 12:26:14 EST Article-I.D.: psivax.300 Posted: Mon Feb 4 12:26:14 1985 Date-Received: Sat, 9-Feb-85 04:51:52 EST References: <9300002@bradley.UUCP> Reply-To: friesen@psivax.UUCP (Stanley friesen) Organization: Pacesetter Systems Inc., Sylmar, CA Lines: 36 Summary: In article <9300002@bradley.UUCP> brad@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