Q:

How does that kind of function work?

I found some strange looking function (hope I'm calling it right) and can't really understand its meaning.
Maybe You can help me and tell what does it actually mean and how to use that?
int (*foo(const unsigned i))(const int, const int)
{
   ... // code
   return some_function;
}

It looks like a function pointer but the pointers I've seen, have been more like these:
void foo(int x, double (*pf)(int)); // function using function pointer as a parameter

double (*pf)(int); // function pointer declaration

Thank You for Your time.

A:

It's defining a function named foo that returns a function pointer.
foo takes a const unsigned int parameter named i and returns a pointer to a function that takes two const ints and returns an int.

