3 ms·
Another weird property about C arrays is that &arr == arr. The reference of an array is the pointer to the first element, which is what `arr` itself decays to.
by dahfizz 4y ago
Another weird property about C arrays is that &arr == arr. The reference of an array is the pointer to the first element, which is what `arr` itself decays to. If arr was a pointer, &arr != arr.
- chasil 4y agoI think it is clearer to say that arr == &arr[0] but your mileage may vary.
- WalterBright 4y agoIs today international speak like a pirate day? arr arr arr
- naniwaduni 4y ago&arr is a pointer to the array. It will happen to point to the same place as the first element, but in fact they have different types, and e.g. (&arr)[0] == arr != arr[0].