HNHacker News
TopNewBestAskShowJobs

hnfairy

3 karma · joined December 26, 2016

submissionscomments
hnfairy··on How to find size of an array in C without sizeof
Despite the argument at the end, this is undefined behavior in the latest C specification. The code dereferences a pointer one past the last element.

C11 6.5.6/8:

If the result points one past the last element of the array object, it shall not be used as the operand of a unary * operator that is evaluated