0

In C++, given that i is the index of the array arr[n], why do those lines of code work

for (int i=1;i<=n;i++)
{printf("%d ", i[arr]);}

In normal cases, it should be arr[i] instead of i[arr], but my teacher used i[arr] and it still worked and require us to explain it, but I just can't figure it out. Can anyone explain this, thank you so much!

yano
  • 4,153
  • 1
  • 19
  • 34
Thien Anh
  • 15
  • 3

0 Answers0