Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
clusmore
on Oct 23, 2016
|
parent
|
context
|
favorite
| on:
The Clockwise/Spiral Rule of C declarations
I think the advice that helped me the most was "Declaration follows usage".
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.
convales
on Oct 23, 2016
|
next
[–]
Declaration follows usage is much more easier to follow than the artificial spiral rules, IMHO with a few typedefs the declaration follows usage can make things pretty simple.
dllthomas
on Oct 24, 2016
|
prev
[–]
To my mind that's one part of the reason the * belongs next to arr rather than next to int.
The other part is `int* x, y`.
Consider applying for YC's Spring batch! Applications are open till Feb 11.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: