19 points | by signa11 2 days ago
6 comments
In practice, the [static n] notation can give you useful warnings and bounds checking.
https://godbolt.org/z/PzcjW4zKK
And while the (*array_ptr)[3] notation take a moment to get used to, it is very logical. If you have a pointer to an array, you dereference it first and then indx into it. Again, useful for bounds checking: https://godbolt.org/z/ao1so9KP7
What is **int[3][5]
there's no array type in c
Yes it does. It just decays to a pointer at the slightest touch.
Paging walter bright
C's biggest mistake.
But in other news most don't know that a[3] == 3[a]
In practice, the [static n] notation can give you useful warnings and bounds checking.
https://godbolt.org/z/PzcjW4zKK
And while the (*array_ptr)[3] notation take a moment to get used to, it is very logical. If you have a pointer to an array, you dereference it first and then indx into it. Again, useful for bounds checking: https://godbolt.org/z/ao1so9KP7
What is **int[3][5]
there's no array type in c
Yes it does. It just decays to a pointer at the slightest touch.
Paging walter bright
C's biggest mistake.
But in other news most don't know that a[3] == 3[a]