I met a strange way of the appeal to an element of the array and thought it`s a mistake but it works. Can you explain how it works?
#include <iostream>
int main()
{
  int a[] = {1,2,3,4};
  std::cout << 1[a];
}
                Expression a[b] is equivalent to *(a + b) so in your example we have:
1[a] which can be written as *(1 + a) which is the same as *(a + 1) which is finally the same as a[1]
BaseAddr[ Offset ] = *( BaseAddr + Offset )
Offset[ BaseAddr ] = *( Offset + BaseAddr ) = *( BaseAddr + Offset )
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With