Reputation: 59
What does this type signature mean? I can't wrap my head around it
int (*) ( int(*) (int,int*), int * *)
Thanks in advance!
Upvotes: 0
Views: 100
Reputation: 154280
what this means
int (*) ( int(*) (int,int*), int * *)
is a
pointer to function (pointer to function (int, pointer to int) returning int, pointer to pointer to int) returning int
Upvotes: 0
Reputation: 223264
int (*) ( int(*) (int,int*), int * *)
is a pointer to a function with return type int
and parameter types int(*) (int,int*), int * *
The first parameter type, int(*) (int,int*)
is a pointer to a function with return type int
and two parameters of type int
and pointer to int
.
The second parameter type, int * *
, is a pointer to a pointer to an int
.
So the whole type is a pointer to a function with:
int
,int
, a parameter of type int
, and a parameter of type pointer to int
, andint
.Upvotes: 1
Reputation: 75062
int (*) ( // a pointer to a function that return int
int(*) (int,int*), // 1st argument is a function pointer (A)
int * * // 2nd argument is a pointer to a pointer to int
)
(A) is:
int(*) ( // a pointer to a function that return int
int, // 1st argument is int
int* // 2nd argument is a pointer to int
)
Therefore, it means a pointer to a function whose return type is int
and 1st argument is "a pointer to a function whose return type is int
and 1st argument is int
and 2nd argument is a pointer to int
" and 2nd argument is a pointer to a pointer to int
.
Upvotes: 2