两个声明如下:
int (*p)[8];
int *p[8];
第一个是single指向 8 个整数的数组的指针,而第二个是array8 个指针,每个指针指向一个整数。
如果你只是踢起来cdecl
,对于这类事情来说非常棒:
pax$ cdecl
Type `help' or `?' for help
cdecl> explain int (*p)[8];
declare p as pointer to array 8 of int
cdecl> explain int *p[8];
declare p as array 8 of pointer to int
cdecl> explain char*(*fp[])(int,float*);
declare fp as array of pointer to function (int, pointer to float)
returning pointer to char
其实有一个顺时针/螺旋规则 http://cskill.wordpress.com/2010/06/09/the-clockwisespiral-rule-by-david-anderson/你可以在脑子里做这件事,但自从我发现之后我就不必担心了cdecl
,出于同样的原因,我不再在脑海中将大的任意 32 位数字从十进制转换为十六进制 - 我can如果必须的话,但使用工具会更容易:-)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)