3 ms·
Another source of surprise: 4[arr] // same as arr[4]
by teo_zero 2y ago
Another source of surprise:
4[arr] // same as arr[4]
- trealira 2y agoBy the same principle, these are exactly the same: arr[i][j] j[i[arr]] These are the simplifications you'd do. You only need to know that a[x][y] is equivalent to (a[x])[y], and that a[x] is the same as x[a]. arr[i][j] (arr[i])[j] (i[arr])[j] j[i[arr]]
- stefanos82 2y agoThanks to array decay to pointer, we basically have `*(array_label+offset)` which in this case of yours we have `*(offset+array_label)`; in other words, `*(arr+4)` is the same as `*(4+arr)`...that's it, really!