Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 beta 3/9/83; site frog.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!cybvax0!frog!john
From: john@frog.UUCP (John Woods)
Newsgroups: net.lang.c
Subject: Re: Function returning pointer to function ?
Message-ID: <231@frog.UUCP>
Date: Wed, 17-Jul-85 11:57:11 EDT
Article-I.D.: frog.231
Posted: Wed Jul 17 11:57:11 1985
Date-Received: Thu, 18-Jul-85 20:31:04 EDT
References: <11582@brl-tgr.ARPA>
Organization: Charles River Data Systems, Framingham MA
Lines: 25

> 	Is it legal for a function to return a pointer to a function?
> It seems like it should be, but if so, how would one define and
> declare such a function?
> 

typedef int (*pfi)();

int spiffy() {
	return 0x69;
}

pfi foobar() {
	return spiffy;
}

There you have it.  It's simple, and EVEN readable.  Nearly so, anyway.


--
John Woods, Charles River Data Systems, Framingham MA, (617) 626-1101
...!decvax!frog!john, ...!mit-eddie!jfw, jfw%mit-ccc@MIT-XX.ARPA

I have a bad habit of thinking of tremendously witty .signatures just before
I fall asleep.  If I kept paper by my bed, you'd probably be laughing
uncontrollably at this very moment.  Sorry.