The priority rules of C language declaration mentioned in Expert C programming are as follows:
A declares that it reads data starting from its name and then reads data in order of priority;
The priority of B is from high to low:
B .1 The Section enclosed in parentheses in the statement;
B .2 suffix OPERATOR: brackets () indicate that this is a function, and square brackets [] indicate that this is an array;
B .3 prefix OPERATOR: asterisk * identifies "pointer ";
C. If the const and (or) Volatile keywords follow the type specifiers (such as int and long), it acts on the type specifiers. In other cases, const and (or) the volatile keyword acts on the pointer asterisk next to its left.
Examples:Char * const * (* Next )();
A next --- next is the declared name.
B .1 (* Next) --- next is a pointer...
B .2 (* Next) () --- next is a function pointer.
B .3 * (* Next) () --- next is a function pointer, which returns a pointer...
C char * const --- a constant pointer to a character type
Therefore, the meaning of char * const * (* Next) (); is:Next is a function pointer. This function returns a constant pointer to the character type.
Let's analyze a statement by ourselves:
INT (* Foo () [];
First, let's take a look at the result:Foo is a function that returns a pointer to an integer array.. Right? The following describes the specific derivation process:
A foo --- foo is the declared name.
B .2 Foo () --- foo is a function.
B .3 (* Foo () --- foo is a function that returns a pointer...
B .2 (* Foo () [] --- foo is a function that returns a pointer to an array.
C int (* Foo () [] --- foo is a function that returns a pointer to an integer array.