C's index[arr] notation

https://news.ycombinator.com/item?id=2436101
by leegao • 15 years ago
5 4 15 years ago

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

Related Stories

Loading related stories...

Source preview

news.ycombinator.com