1. 從變量名開始 -------------------------------------------- fp1
2. 往右看,什么也沒有,碰到了),因此往左看,碰到一個(gè)* ------ 一個(gè)指針
3. 跳出括號(hào),碰到了(int) ----------------------------------- 一個(gè)帶一個(gè)int參數(shù)的函數(shù)
4. 向左看,發(fā)現(xiàn)一個(gè)* --------------------------------------- (函數(shù))返回一個(gè)指針
5. 跳出括號(hào),向右看,碰到[10] ------------------------------ 一個(gè)10元素的數(shù)組
6. 向左看,發(fā)現(xiàn)一個(gè)* --------------------------------------- 指針
7. 向左看,發(fā)現(xiàn)int ----------------------------------------- int類型
總結(jié):fp1被聲明成為一個(gè)函數(shù)的指針,該函數(shù)返回指向指針數(shù)組的指針. 再來看一個(gè)例子:
int *( *( *arr[5])())();
閱讀步驟:
1. 從變量名開始 -------------------------------------------- arr
2. 往右看,發(fā)現(xiàn)是一個(gè)數(shù)組 ---------------------------------- 一個(gè)5元素的數(shù)組
3. 向左看,發(fā)現(xiàn)一個(gè)* --------------------------------------- 指針
4. 跳出括號(hào),向右看,發(fā)現(xiàn)() -------------------------------- 不帶參數(shù)的函數(shù)
5. 向左看,碰到* ------------------------------------------- (函數(shù))返回一個(gè)指針
6. 跳出括號(hào),向右發(fā)現(xiàn)() ------------------------------------ 不帶參數(shù)的函數(shù)
7. 向左,發(fā)現(xiàn)* --------------------------------------------- (函數(shù))返回一個(gè)指針
8. 繼續(xù)向左,發(fā)現(xiàn)int --------------------------------------- int類型
總結(jié):??
還有更多的例子:
float ( * ( *b()) [] )(); // b is a function that returns a
// pointer to an array of pointers
// to functions returning floats.
void * ( *c) ( char, int (*)()); // c is a pointer to a function that takes
// two parameters:
// a char and a pointer to a
// function that takes no
// parameters and returns
// an int
// and returns a pointer to void.
void ** (*d) (int &,
char **(*)(char *, char **)); // d is a pointer to a function that takes
// two parameters:
// a reference to an int and a pointer
// to a function that takes two parameters:
// a pointer to a char and a pointer
// to a pointer to a char
// and returns a pointer to a pointer
// to a char
// and returns a pointer to a pointer to void
float ( * ( * e[10])
(int &) ) [5]; // e is an array of 10 pointers to
// functions that take a single
// reference to an int as an argument
// and return pointers to
// an array of 5 floats.





