Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!hellgate.utah.edu!caen!zaphod.mps.ohio-state.edu!maverick.ksu.ksu.edu!ux1.cso.uiuc.edu!csrd.uiuc.edu!sp64.csrd.uiuc.edu!bliss From: bliss@sp64.csrd.uiuc.edu (Brian Bliss) Newsgroups: comp.lang.c Subject: Re: A question on Function declaration Keywords: pointer function integer Message-ID: <1991Feb13.213725.27598@csrd.uiuc.edu> Date: 13 Feb 91 21:37:25 GMT References: <5806@agate.UUCP> Sender: news@csrd.uiuc.edu (news) Reply-To: bliss@sp64.csrd.uiuc.edu (Brian Bliss) Organization: Center for Supercomputing Research and Development Lines: 32 > I would like to declare a function which returns a pointer to a function >(that returns an integer). int (*f( ))(); ^arg list goes here (arg list for returned func goes in trailing parens) >I tried the following (among others): > ((int *)()) func() ; it is never legal to put parenthesis around a type specifier, except when performing the cast operation. just remember that declaration look like the var's usage, so you have a function f: f(); a function returning a pointer: * f(); or *(f()); "apply the function, then dereference the ptr" a function returning a pointer to a function (*f())(); or (*(f()))(); "apply the function, deref ptr, apply result" bb