2 ms·
> "&array" and "&array[0]" both refer to the same memory location, but they're of different types. "&array[0]" also does a dereference, which may cause undefin
by deogeo 8y ago
> "&array" and "&array[0]" both refer to the same memory location, but they're of different types.
"&array[0]" also does a dereference, which may cause undefined behaviour if array is null or invalid. You can get fun stuff like the optimizer omitting null checks later on.
- DerekL 8y agoInteresting. In C, “&array[0]“ is the same thing as “(array + 0)”, but in my copy of the C11 draft standard, I can't find anything about adding zero to a null pointer.