I've known that this is true:
x[4] == 4[x]
What is the equivalent for multi-dimensional arrays? Is the following true?
x[4][3] == 3[x[4]] == 3[4[x]]
I've known that this is true:
x[4] == 4[x]
What is the equivalent for multi-dimensional arrays? Is the following true?
x[4][3] == 3[x[4]] == 3[4[x]]
x[y] is defined as *(x + (y))
x[y][z] would become *(*(x + (y)) + z)
x[y[z]] would become *(x + (*(y + (z))))
x[4][3] would become *(*(x + (4)) + 3) would become *(*(x + 4) + 3)
3[x[4]] would become *(3 + (*(x + (4)))) would become *(*(x + 4) + 3)
3[4[x]] would become *(3 + (*(4 + (x)))) would become *(*(x + 4) + 3)
Which means they are all equivalent.
Yes. In each case x is an array which decays to a pointer and then has pointer arithmetic performed on it.