Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!uwvax!astroatc!nicmad!madnix!schaut From: schaut@madnix.UUCP (Rick Schaut) Newsgroups: comp.lang.c Subject: Re: Pointers to functions on Xenix Message-ID: <839@madnix.UUCP> Date: 10 Sep 89 01:26:49 GMT References: <1989Sep8.021802.29203@Octopus.COM> Reply-To: schaut@madnix.UUCP (Rick Schaut) Organization: ARP Software, Madison, WI Lines: 26 In article <1989Sep8.021802.29203@Octopus.COM> stever@octopus.UUCP (Steve Resnick ) writes: [Defines an array of structures where one element of the structure is a pointer to a function returning an int.] | /* When I get to the point where I execute an internal function, I call the | routine here.. | */ | (Cmds[idx].fptr)(c,v); /* Here is where I call the function */ | | This is what the compiler doesn't like. The error message is something like | | Term does not evaluate to a function. Exactly, the term evaluates to a pointer. You need to go through a level of indirection to get to the function that the pointer points to. The correct expression is: (*Cmds[idx].fptr)(c,v); See K&R 5.11 (p. 118, 2nd Ed.). See, also, operator precedence on p. 52. -- Richard Schaut ArpaNet: madnix!schaut@cs.wisc.edu UseNet: ...uwvax!astroatc!nicmad!madnix!schaut {decvax!att}!