functions returning pionters to functions

ark at rabbit.UUCP ark at rabbit.UUCP
Thu Dec 15 01:01:54 AEST 1983


Suppose I want to write a function f that returns a pointer to a
function returning an integer.  I first think about how I'm going to
invoke it.

	f(x)

is going to be a pointer to a function, so

	*f(x)

will be this function itself.  Well, since * binds less tightly than
function calls, I must invoke the (secondary) function by saying

	(*f(x))()

and this expression is now an integer.   If I want to write f, I therefore
say:

	inf (*f(x))()
		int x;
	{
		...
	}

Works like a charm.



More information about the Comp.unix mailing list