What does this C statement mean?

匿名 (未验证) 提交于 2019-12-03 08:59:04

问题:

I came across this line:

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

Can anybody tell me what it is?

回答1:

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

  1. (*[10])
  2. (*[10])(int *) int as its argument
  3. (void (*[10])(int *)) 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.



回答2:

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



回答3:

You can find explanations here:



回答4:

http://cdecl.ridiculousfish.com/?q=void+%28*%28*x%29%28void+%28*%5B10%5D%29%28int+%29%29%29%28int+%29



回答5:

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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!