0
Explain this please.....
int(*p)(char*p)[ ](++). what is the meaning of this ?
1 Answer
+ 11
Let's see...
int (*p)(char *p)[]
declares p as a pointer to a function, which takes a pointer to a character as an argument/parameter of the function. This function has return type of int[].
Now, look at operator precedence for C/C++.
http://en.cppreference.com/w/cpp/language/operator_precedence
"Associativity specification is redundant for unary operators and is only shown for completeness: ... ", "... unary postfix operators always associate left-to-right (a[1][2]++ is ((a[1])[2])++)".
That said, this code seems to be missing segments? At the current point, it does not make sense to place postfix increment operator there. C also does not allow function declarators to return array type:
The C standard (ISO/IEC 9899:2011): 6.7.6.3 Function declarators (including prototypes)
Constraints
1 A function declarator shall not specify a return type that is a function type or an array type.
More references:
- https://stackoverflow.com/questions/5093090/whats-the-syntax-for-declaring-an-array-of-function-pointers-without-using-a-se
- https://bytes.com/topic/c/answers/901258-what-do-int-p-char-char-p-int-mean