Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Functions within structures Message-ID: <14402@smoke.brl.mil> Date: 9 Nov 90 07:16:36 GMT References: <2203@abcom.ATT.COM> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 22 In article <2203@abcom.ATT.COM> mdb@abcom.ATT.COM (5013 ) writes: -> int add_rec(); -> int find_rec(); -> int quit(); -> unsigned int records=0; -> typedef struct { -> char key; -> int x_row; -> int y_row; -> char msg[20]; int (*foo)(); /* ADD THIS MEMBER */ -> } MENU; -> MENU menu[MENU_ITEM+1] = { -> { '1',7,25,"Add Phone Number",add_rec() }, /* CHANGE THE ABOVE TO: */ { '1', 7, 25, "Add phone number", add_rec }, [...] -> } ; [...] -> menu_opt = select(); -> (*(menu[menu_opt].foo))(); /* That's okay although excessively parenthesized. */