Path: utzoo!attcan!uunet!jarthur!usc!zaphod.mps.ohio-state.edu!uwm.edu!ux1.cso.uiuc.edu!tank!mimsy!tove.umd.edu!cml From: cml@tove.umd.edu (Christopher Lott) Newsgroups: comp.lang.c Subject: Re: How do I define .... Keywords: function returning function pointer, ANSI C, Message-ID: <22981@mimsy.umd.edu> Date: 8 Mar 90 15:12:20 GMT References: <1990Mar7.212639.10313@dinorah.wustl.edu> Sender: news@mimsy.umd.edu Reply-To: cml@tove.umd.edu (Christopher Lott) Organization: The University of Maryland Dept of Computer Science Lines: 29 In article <1990Mar7.212639.10313@dinorah.wustl.edu> art@dinorah.wustl.edu (Arthur B. Smith) writes: > The simplest question is "Can you define a function of no >arguments that returns a pointer to a function returning int?" > > The next question is "How?" I didn't know the answer, but I did know how to get the answer. A program called "cdecl" comes in very handy at these times. In the following script, I typed the first line, it answered with the second. Script started on Thu Mar 8 10:00:06 1990 tove:/u/cml(1)% cdecl declare foo as function returning pointer to function returning int int (*foo())() ^D tove:/u/cml(2)% exit script done on Thu Mar 8 10:00:36 1990 The cdecl program is available from host mimsy.umd.edu (128.8.128.8) via anonymous ftp in file "cdecl.shar" (or I could mail it to a desperate UUCP site :-). You must have lex & yacc to compile it. chris... -- cml@tove.umd.edu Computer Science Dept, U. Maryland at College Park 4122 A.V.W. 301-454-8711