例一
char *(*next)()
1、*(*next)() 为 char 类型
2、(*next)() 为指向char的指针
3、(*next) 为函数,参数列表为()
4、next 为指针,指向函数,函数参数列表为(),函数返回值为指针,该指针指向char
例二
char *(* test[10])(int p)
1、*(* test[10])(int p) 为char类型
2、(* test[10])(int p) 为指针,指向char
3、(* test[10])为函数,参数列表为(int p)
4、test[10] 的类型为函数指针
5、test为函数指针数组,数组有10个指针,指向函数的参数列表为(int p),返回值为指针,指针指向char
例三
int (*(*func)[5])(int *p);
1、(*(*func)[5])(int *p); 为int类型
2、(*(*func)[5]) 为函数,参数列表为(int *p)
3、(*func)[5] 的类型为函数指针
4、(*func) 为函数指针数组,长度为5
5、func 指针,指向数组
6、func 是指针,指向一个数组,该数组为函数指针数组,长度为5,数组中元素指向一个函数,函数的返回值为为int,函数参数列表为(int *p)
例四 const
(1)const int * grape
(2)int const * grape
(3)int * const grape ;
(4)int const * const * grapepp ;
只有(3)是指针只读,(1)(2)中都是指针指向的对象只读。
const 修饰的是const 后面的接着的整个对象。如第(4)行中,第一个const修饰的是 **grapepp,第二个const修饰的是*grapepp。
这样,**grapepp = 0 ;*grapepp = 0 ;这两个赋值语句都是错误的,但是grapepp=0; 这个赋值语句是正确的。
例五
char * const *(*next)()
1、 * const *(*next)() 为char类型
2、*(*next)() 为指针,指向1
3、(*next)() 为指针,指向指针,所指向指针说明如2
4、(*next) 为函数,函数列表为(),返回值为3
5、next 为指针,指向4
综上所述,next是一个指针,指向一个函数,函数参数列表为();函数返回值为指针,指向一个指针,指向的指针类型为char,指向的指针只读。