In your specific example there is no difference.
In more general case one difference between these two approaches stems from the fact that in case of []
syntax the language performs "usual" checks for correctness of array declaration. For example, when the []
syntax is used, the array element type must be complete. There's no such requirement for pointer syntax
struct S;
void foo(struct S *a); // OK
void bar(struct S a[]); // ERROR
A specific side-effect of this rule is that you canon declare void *
parameters as void []
parameters.
And if you specify array size, it has to be positive (even though it is ignored afterwards).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…