C++ asterisk and bracket operators used together
c++, operators
Solution
Type declarations have an expression-like syntax, so you parse them as you would an expression:
x x is
*x a pointer
(*x)[] to an array of unknown dimensions
int (*x)[] of int
The precedence rule is that the operators to the right bind tighter than those to the left, in each case, the operator closer to the element binds tighter, and finally, that parentheses can be used to change these bindings, so:
int *x[]; is an array of pointers,
int *(x[]); as is this.
int (*x)[]; whereas here, the parentheses change the bindings.
Problem
Sorry for the crappy title, but I don't know how to better describe this problem. What is the meaning of: ``` int (*x)[]; ``` and how to initialize it? I know it isn't `int *x[]` since: ``` int a,b; int (*x)[] = {&a, &b}; ``` won't compile. Thank you in advance.