by rfw · 10y ago · 0 comments
int* arr[][10];
Spiral rule would state "arr is an array of pointers to arrays of 10 ints", where actually it would be "arr is an array of array of 10 pointers to int".Instead, when you write declarations, do it from right-to-left, e.g.:
char const* argv[];
"argv is an array of pointers to constant characters"It doesn't help with reading, unfortunately.
int* arr[][10];
If you index twice into arr and then dereference, you'll get an int. So arr must be an array of array of pointer to int.The other part is `int* x, y`.
char const
rather than const char
Is there a reason to prefer the second version? It's a lot more popular in my experience.Also your argument about which modifies which is strongly anglocentric: there are plenty of people whose native language puts modifiers after the things they modify.