char ** p1; // pointer to pointer to char
const char **p2; // pointer to pointer to const char
char * const * p3; // pointer to const pointer to char
const char * const * p4; // pointer to const pointer to const char
char ** const p5; // const pointer to pointer to char
const char ** const p6; // const pointer to pointer to const char
char * const * const p7; // const pointer to const pointer to char
const char * const * const p8; // const pointer to const pointer to const char
注:p1是指向char类型的指针的指针;
p2是指向const char类型的指针的指针;
p3是指向char类型的const指针;
p4是指向const char类型的const指针;
p5是指向char类型的指针的const指针;
p6是指向const char类型的指针的const指针;
p7是指向char类型const指针的const指针;
p8是指向const char类型的const指针的const指针。
typedef char * a; // a is a pointer to a char
typedef a b(); // b is a function that returns a pointer to a char
typedef b *c; // c is a pointer to a function that returns a pointer to a char
typedef c d(); // d is a function returning a pointer to a function that returns a pointer to a char
typedef d *e; // e is a pointer to a function returning a pointer to a function that a pointer to a char
e var[10]; // var is an array of 10 pointers to functions returning pointers to functions returning pointers to chars.
原文地址:http://www.codeproject.com/cpp/complex_declarations.asp