Path: utzoo!attcan!uunet!ncrlnk!ncrcae!hubcap!gatech!bloom-beacon!bu-cs!buengc!bph From: bph@buengc.BU.EDU (Blair P. Houghton) Newsgroups: comp.lang.c Subject: Re: help with a MESSY C definition!!? Message-ID: <1506@buengc.BU.EDU> Date: 22 Nov 88 01:13:16 GMT References: <207600008@s.cs.uiuc.edu> Reply-To: bph@buengc.bu.edu (Blair P. Houghton) Followup-To: comp.lang.c Organization: Boston Univ. Col. of Eng. Lines: 35 In article <207600008@s.cs.uiuc.edu> dlee@s.cs.uiuc.edu writes: > >I usually don't have any trouble with C, but this is a glaring exception: I >need the syntax of definition for an array (of arbitrary size) of pointers to >functions returning pointers to integer (HOW'S *THAT* FOR A DOOZY!!!). My >closest (possibly correct) guess follows: > > int *(*opfuncs[])() = { > . > . > . > }; Let's play precedence: opfuncs[] is an array; *opfuncs[] is an array of pointers (*opfuncs[])() is an array of pointers to function *(*opfuncs[])() is an array of pointers to function returning pointer int *(*opfuncs[])() is an array of pointers to function returning pointer to int. I'll buy it. Now, prove that (int *(*)()) is unambiguously "cast to pointer to function returning pointer to int" and never misinterpreted as "cast to function returning pointer to pointer to int," whatever the hell that means... --Blair "Take two asterisks and call me in the morning."