Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!mcvax!vmucnam!crin!tombre From: tombre@crin.UUCP (Karl Tombre) Newsgroups: net.lang.c Subject: Re: Array of pointers to functions Message-ID: <156@crin.UUCP> Date: Tue, 8-Apr-86 10:52:10 EST Article-I.D.: crin.156 Posted: Tue Apr 8 10:52:10 1986 Date-Received: Thu, 10-Apr-86 08:32:26 EST References: <2398@brl-smoke.ARPA> Reply-To: tombre@crin.UUCP (Karl Tombre) Organization: C.R.I.N., Nancy, France Lines: 37 Summary: hints for finding the right syntax In article <2398@brl-smoke.ARPA> woody%Juliet.Caltech.Edu@cit-hamlet.ARPA writes: >I'm confused. How do you specify an array of pointers to functions? Do >you do it: > > int (*foo[])(); > >or do you do it: > > int ((*foo)())[]; Your compiler is right of course in taking the first as valid. A you say, this may not be given in K&R, but I found some equivalence rules in another book : "Advanced C: food for the educated palate", by N. Gehani, Computer Science Press (ISBN 0-88175-078-6). You can find out this way: foo : array of pointers to functions returning int => foo[] : pointer to function returning int => *foo[] : function returning int => (*foo[])() : int and thus you have the right syntax. I posted this rather than replying as you are not on UUCP and I have already experienced that mail sent through complex channels does not reach its destination easily. Best regards, -- --- Karl Tombre @ CRIN (Centre de Recherche en Informatique de Nancy) UUCP: ...!vmucnam!crin!tombre or ...!inria!crin!tombre COSAC: crin/tombre POST: Karl Tombre, CRIN, B.P. 239, 54506 VANDOEUVRE CEDEX, France Les plus desesperes sont les chants les plus beaux, Et j'en sais d'immortels qui sont de purs sanglots. Alfred de Musset.