Why is it possible to access an nth element of an array using index as a[n] as well as n[a]?
Eg:
int a[4]={1,2,3,4];
The second element can be accessed both as a[2] (the normal way!!) and also as 2[a]
Array elements referenced by way of index is resolved by pointer arithmetic. But this still doesnot explain how references such as 2[a] is handled!!
Eg:
int a[4]={1,2,3,4];
The second element can be accessed both as a[2] (the normal way!!) and also as 2[a]
Array elements referenced by way of index is resolved by pointer arithmetic. But this still doesnot explain how references such as 2[a] is handled!!