3 ms·
> "&array" and "&array[0]" both refer to the same memory location, but they're of different types. Indeed. And isn't this what makes the classic "countof" macr
by Stratoscope 8y ago
> "&array" and "&array[0]" both refer to the same memory location, but they're of different types.
Indeed. And isn't this what makes the classic "countof" macro possible? The macro returns the number of elements in an array, calculating this by dividing the size of the array by the size of the first element:
#define countof( array ) ( sizeof(array) / sizeof((array)[0]) )