4 ms·
With C arrays, why is it the case that a[5] == 5[a]?
- busfahrer 3y agoThis essentially comes down to the commutative property of pointer arithmetic. This was also used in David Korn‘s (creator of the Korn shell) 1987 IOCCC entry: https://www.ioccc.org/1987/korn/korn.c https://www.ioccc.org/1987/korn/korn.c
- NoZZz 3y agoa[5] is the same as *(a+5) and addition is commutative.