Comment on Ask HN: Favorite pointer tricks in C?parentComments−alan-crowe15yarray + index == index + array needs justificationOne expects the generic + in a+i to get expanded to raw addition .+. and raw multiplication .x. with s the size of elements of the array a .+. s .x. i One expects index + array to throw a type error because index is just a number and doesn't have an element size.So I'm guessing that the real reason that the trick works is that generic + has three methods with signatures int + int array + int int + array
Comments
array + index == index + array needs justification
One expects the generic + in a+i to get expanded to raw addition .+. and raw multiplication .x. with s the size of elements of the array
One expects index + array to throw a type error because index is just a number and doesn't have an element size.So I'm guessing that the real reason that the trick works is that generic + has three methods with signatures