What does this C statement mean?

前端 未结 5 1594
无人共我
无人共我 2020-12-01 03:55

I came across this line:

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

Can anybody tell me what it is?

5条回答
  •  我在风中等你
    2020-12-01 04:13

    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.

提交回复
热议问题