Path: utzoo!attcan!uunet!convex!killer!ames!ncar!mailrus!tut.cis.ohio-state.edu!bloom-beacon!athena.mit.edu!tada From: tada@athena.mit.edu (Michael Zehr) Newsgroups: comp.lang.c Subject: typedefs and prototypes Summary: how do i declare/define this? Message-ID: <7135@bloom-beacon.MIT.EDU> Date: 20 Sep 88 19:37:56 GMT Sender: daemon@bloom-beacon.MIT.EDU Reply-To: tada@athena.mit.edu (Michael Zehr) Organization: Massachusetts Institute of Technology Lines: 33 I'm writing a graphics interface library which ends up passing a lot of pointers to functions. I've run into a problem with typedefs and prototypes: /* typedef and prototype declaration of a widget */ typedef void (*Keyboard_widget)(int key, void *data); Keyboard_widget kb_widget1; /* definition of a widget */ void kb_widget1(int c, void *data) {...} I get a "conflicts with previous declaration" at that point. If I try to define the widget by the typedef, what syntax do i use??? Keyboard_widget kb_widget1 /* where do the formal parameters go??? */ {...} Anyone have any suggestions? (The reason why i want to use the typedef is that i have to pass objects of type Keyboard_widget into some functions, and store them in structures. i can use a "normal" prototype for the function but is it strictly conforming when i later on pass a pointer to that function to a procedure that's expecting a Keyboard_widget???) -michael j zehr