Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
654 views
in Technique[技术] by (71.8m points)

pointers - What does this C statement mean?

I came across this line:

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

Can anybody tell me what it is?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...