080-addr-array.c (537B)
1 /* Strict-C semantic: &arr yields T(*)[N], not T*. 2 * 3 * The numeric address is the same either way; the difference is 4 * static type, which determines pointer-arithmetic stride. 5 * 6 * strict C: &arr + 1 advances by sizeof(T[N]) -> one-past-end 7 * deviation: &arr + 1 advances by sizeof(T) -> arr[1] 8 * 9 * Discriminator: ((int*)(&arr + 1)) - arr should be N (one past end). 10 * 11 * Locked-in expectation: 3 (for arr[3]). 12 */ 13 14 int arr[3] = { 10, 20, 30 }; 15 16 int main(void) { 17 int *p = (int *)(&arr + 1); 18 return p - arr; 19 }