3 ms·
You can write that in C, but it doesn't really do anything. It's equivalent to void f(int n, int a[]) { } Why? So that you can write void f(int n
by Animats 3y ago
You can write that in C, but it doesn't really do anything. It's equivalent to
void f(int n, int a[]) {
}
Why? So that you can write
void f(int n, int m, int a[n][m]) {
}
which declares a 2-dimensional array parameter. In that case, the "m" is used to compute the position in the array for a 2D array. The "m" doesn't do anything.
This is equivalent to writing
void f(int n, int m, int a[][m]) {
}
This is C's minimal multidimensional array support, known by few and used by fewer.
Over a decade ago, I proposed that sizes in parameters should be checkable and readable I worked out how to make it work.[1] But I didn't have time for the politics of C standards.
[1] http://animats.com/papers/languages/safearraysforc43.pdf http://animats.com/papers/languages/safearraysforc43.pdf