Question: Big picture: I have a module with functions and a module with procedures and functions over those functions.

When I combine two functions (from function's module interface):

```
double f1(double alpha, double x);
double f2(double beta, double x);

```

In several ways, (one of them is adding):

```
double OP_Addition(double (*f)(double,double) , double (*g)(double,double), double param1, double param2, double x);

```

Gives no problem with the following (piece of) implementation:

```
z1 = (*f)(param1, x);
z2 = (*g)(param2, x);
y = z1 + z2;
return y;

```

But when I want to return a pointer to a "new" function, something like:

```
void *OP_PAdd( double (*f)(double,double), double param3 );

```

I can not get it to work properly, neither make the right "call". I want to have use the output "function" as input in other functions.

Answer: 
When returning a function from another function, the cleanest way to do this is with a `typedef`:

```
typedef double (*ftype)(double, double);

```

Then you can declare your function like this:

```
ftype OP_PAdd( ftype f, double param3 )
{
    ....
    return f1;
}

```

You can do this without a `typedef`, but it's messy:

```
double (*OP_PAdd( double (*f)(double,double), double param3 ))(double,double)
{
    return f1;
}

```

So when you have function pointers as either parameters or return values of other functions, use a `typedef`.

EDIT:

While you could declare the type like this:

```
typedef double ftype(double, double);

```

You can never directly use a type like this in practice. A function can't return a function (only a pointer to a function), and a variable of this type can't be assigned to. 

Also, you don't need to explicitly dereference a function pointer to call the function, so the fact that the pointer itself is hidden is not a big issue. It's also convention to define function pointers as a `typedef`. From the [man page for `signal`](http://linux.die.net/man/2/signal):

```
   #include <signal.h>

   typedef void (*sighandler_t)(int);

   sighandler_t signal(int signum, sighandler_t handler);

```
So you want a function to return a pointer to a function.

```
double retfunc()
{
   return 0.5;
}

double (*fucnt)()
{
  return retfunc;
}

main()
{
   printf("%f\n", (*funct())());
}

```