Type of function returning function.

david nugent david at csource.oz.au
Fri Jul 13 01:15:24 AEST 1990


In <1990Jul10.024205.17382 at media.uucp> rmf at media.uucp (Roger Fujii) writes:

>So, just how does one type a function returning a pointer to a function?
>(other than the obvious void *)

>Example:

>int foo(buff)
>char	*buff;
>{
>	return atoi(buff);
>}

>TYPE bar()
>{
>	return foo;
>}

>I would have thought that it would be something like
>int ((*)()), but gcc doesn't agree.  Help...


Believe it or not (it looks quite strange):

int (*bar (void))()
{
	return foo;
}

-- 
_______________________________________________________________________________
 Unique Computing Pty Ltd  Melbourne  Australia  -  Communications Specialists 
        david at csource.oz.au    3:632/348 at fidonet    28:4100/1 at signet           



More information about the Comp.lang.c mailing list