A reference to a function

Hello,


What does the second argument of this function actually do? I couldn't find anything on the web regarding it.


1
2
3
4
5
6
7
8
int main ()

{
int f(int* (*g)(int*));

}

f only takes one argument, namely a pointer to a function that returns an int* and takes an int* as argument.
Ah ok thanks for the clarification. Why does the function g have a * before it? What does that do in this case?
It means that g is a pointer (a pointer to a function).
So g would be declared as so:

int (* g)(int*x);

right?

Since this is a pointer to a function, this implies there has to be a function somewhere defined that we eventually want to point to that also takes in int*. Would this qualify for such a function:


int h(int* v);

so g is meant to point to a function as such, right?
Yes, if you want to declare g as a regular variable and not as a function parameter that is, except that the return type is int* instead of int in your original code.
Ah right. Thanks for the help again. :D
Topic archived. No new replies allowed.