C's index[arr] notation
I had always assumed that it was merely some strange artifact of the language, until I finally thought about it, and then finally understood:
arr[index] is equivalent to (arr + index), which by the commutative property of addition is equivalent to (index + arr) = index[arr].
Mind = blown
6 comments
[ 3.1 ms ] story [ 22.0 ms ] threadarr[index] == arr + (n * size_of(type)) == (n * size_of(type)) + *arr
C pointer arithmetic already accounts for object sizes.
And it's sizeof, not size_of. And
is completely different from And it's a series of "values".