如何理解这些复杂的指针声明?

时间:2011-08-12 11:22:48

标签: c pointers function-pointers

  

可能重复:
  Complex Declarations

有人可以帮我解决这个问题并帮助我理解吗?

1) char *(*(*a[N])( ))( );

2) char (* (*x[3]) ( ))[5];

3) char (*(*f( ))[ ]) ( );

1 个答案:

答案 0 :(得分:4)

黄金法则是。只需使用http://cdecl.org/

  1. declare a as array 5 of pointer to function returning pointer to function returning pointer to char(我将N替换为5

  2. declare x as array 3 of pointer to function returning pointer to array 5 of char

  3. declare f as function returning pointer to array of pointer to function returning char

  4. 要了解如何自行解释,这是MSDN的一个非常好的解释:Interpreting More Complex Declarators