5 ms·
I think it's worth clarifying that arrays declared in parameter lists are simply just pointers. It's 100% syntactic sugar. So the `int a[n]` is simply treated a
by DSMan195276 10y ago
I think it's worth clarifying that arrays declared in parameter lists are simply just pointers. It's 100% syntactic sugar. So the `int a[n]` is simply treated as `int * a`, and the value inside of the `[]` is ignored completely. This leads to the weird situation that you declared it as `int a[n]`, but `sizeof(a)` just gives the size of a pointer, not the size of the array.
The only special case is `int a[static n]`, which does tell the compiler that `a` has at-least `n` entries. But `a` is still just a pointer in this instance, so `sizeof(a)` still gives the size of a pointer.
Personally, I'd recommend avoiding the syntax purely because of the `sizeof` issue, but its up to you.