Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.6.2.17 $; site bradley.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!inuxc!pur-ee!uiucdcs!bradley!brad From: brad@bradley.UUCP Newsgroups: net.lang.c Subject: Re: pointer to function with structure Message-ID: <9300003@bradley.UUCP> Date: Wed, 30-Jan-85 21:41:00 EST Article-I.D.: bradley.9300003 Posted: Wed Jan 30 21:41:00 1985 Date-Received: Sat, 2-Feb-85 00:22:42 EST References: <9300002@bradley.UUCP> Lines: 46 Nf-ID: #R:bradley:9300002:bradley:9300003:000:528 Nf-From: bradley!brad Jan 30 20:41:00 1985 I found it here it is if you want. #include struct mesg { char *m_str; int (*funcp)(); }; int f1(); int f2(); struct mesg mesg[] = { {"This is message 1", f1 }, {"This is message 2", f2 }, }; main() { char gt[5]; while(gets(gt) != NULL) { switch(gt[0]) { case '1': (*mesg[0].funcp)(1); break; case '2': (*mesg[1].funcp)(2); break; } } } f1(i) int i; { printf("%s\n", mesg[i-1].m_str); printf("%d\n",i); } f2(i) int i; { printf("%s\n", mesg[i-1].m_str); printf("%d\n",i); }