25

I came across this line:

void (*(*x)(void (*[10])(int *)))(int *)

Can anybody tell me what it is?

Tony The Lion
  • 61,704
  • 67
  • 242
  • 415

4 Answers4

43

To break this down yourself, start from the inner most parentheses and work your way out.

  1. (*[10]) <---- Array of 10 pointers
  2. (*[10])(int *) <------ Array of 10 pointers to functions which has a pointer to int as its argument
  3. (void (*[10])(int *)) <------ Array of 10 pointers to functions which has a pointer to int as its argument and returns void
  4. (*x)(void (*[10])(int *)) <------- x is a pointer to a function which has as an argument (an array of 10 pointers to functions which has a pointer to int as its argument and returns void)

.....

I stopped partway through, but hopefully that helps.

Mysticial
  • 464,885
  • 45
  • 335
  • 332
Jesse Good
  • 50,901
  • 14
  • 124
  • 166
10

cdecl is very helpful for this kind of thing. It says:

declare x as pointer to function (array 10 of pointer to function (pointer to int) returning void) returning pointer to function (pointer to int) returning void

Seth Carnegie
  • 73,875
  • 22
  • 181
  • 249
5

You can find explanations here:

Alexey Frunze
  • 61,140
  • 12
  • 83
  • 180
3

A pointer to a function which has an array of 10 pointers to functions that has int * argument and return type void as argument, and returns a pointer to a function which has int * argument and return type void.

Source