How does one define and return a function inside a function?
For instance, we have a function like:
float foo(float val) {return val * val;}
Now, what is needed is a function like bar:
typedef float (*func_t)(float)
// Rubish pseudo code
func_t bar(float coeff) {return coeff * foo();}
// Real intention, create a function that returns a variant of foo
// that is multiplied by coeff. h(x) = coeff * foo(x)
The only thing I've came up with so far is using lambda or a class. Is there a straight forward way to do this without being convoluted needlessly?