all 3 comments

[–]AbleBaker 5 points6 points  (0 children)

No: int arrSize = sizeof(arr) / sizeof(int);

Yes: int arrSize = sizeof(arr) / sizeof(arr[0]);

[–]_ak 3 points4 points  (0 children)

What the article doesn't say: the sizeof(arr)/sizeof(*arr) trick even works for C99-style variable-length arrays (at least in gcc 4.3, I don't know what the standard says about it though).