Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!nstn.ns.ca!news.cs.indiana.edu!samsung!zaphod.mps.ohio-state.edu!usc!apple!netcom!teda!ditka!mcdchg!tellab5!balr!clrcom!rmartin From: rmartin@clear.com (Bob Martin) Newsgroups: comp.lang.c Subject: Re: A question on Function declaration Keywords: pointer function integer Message-ID: <1991Feb14.182009.8744@clear.com> Date: 14 Feb 91 18:20:09 GMT References: <5806@agate.UUCP> Organization: Clear Communications, Inc. Lines: 35 In article <5806@agate.UUCP> joshi@motcid.UUCP (Abhay B. Joshi) writes: >I would like to declare a function which returns a pointer to a function >(that returns an integer). I have been unable to strike at the correct >syntax of such a declaration. > >I tried the following (among others): > ((int *)()) func() ; > >Doesn't work. > >Thanks for any hints/answers. > >-- Abhay -- Try this one. Net people please check!!! int (*p)() p is a pointer to a function returning int. (int (*)()) f() f is a func returning a pointer to a func returning int. You are much better off building your type via typedefs!! typedef int (*pfint)(); /* ptr to function returning int */ pfint f(); /* declares f as func returning ptr to func returning int */ -- +-Robert C. Martin-----+:RRR:::CCC:M:::::M:| Nobody is responsible for | | rmartin@clear.com |:R::R:C::::M:M:M:M:| my words but me. I want | | uunet!clrcom!rmartin |:RRR::C::::M::M::M:| all the credit, and all | +----------------------+:R::R::CCC:M:::::M:| the blame. So there. |