Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/5/84; site mnetor.UUCP
Path: utzoo!utcs!mnetor!george
From: george@mnetor.UUCP (George Hart)
Newsgroups: net.lang.c
Subject: Re: Functions returning pointers to functions
Message-ID: <1373@mnetor.UUCP>
Date: Thu, 18-Jul-85 10:37:07 EDT
Article-I.D.: mnetor.1373
Posted: Thu Jul 18 10:37:07 1985
Date-Received: Thu, 18-Jul-85 11:47:23 EDT
Organization: Computer X (CANADA) Ltd., Toronto, Ontario, Canada
Lines: 30

I'm sorry I've lost the original reference but someone asked
how to declare a function returning a pointer to a function
(returning whatever).

Here's some trivial code that illustrates one way.  Using typedef's is better
way especially if you are going to use multiple levels of indirection
(maybe not a good idea to begin with).

extern int printf();

main()
{
    int (*func())();

    (func())("This is the %dst string.\n",1);
}

int (*func())()
{
    return(printf);
}

-- 


Regards,

George Hart, Computer X Canada Ltd.
UUCP: {allegra|decvax|linus|ihnp4}!utzoo!mnetor!george
BELL: (416)475-8980