What IndexNum[ptr] actually is? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What IndexNum[ptr] actually is?

While participating in challanges, I encountered statements like 3[ptr] Wht they actually are, and what we call them, i unable to attach a screenshot, I can understand how this does work, but just want to grab some more details, i have no idea about what we call them so can't google, and mostly, I'm getting answer related to arrays and indexing, but nothing like this. The code is like .. int ptr[2][3]={1,2,3,4,5,6}; std::cout<<2[ptr[1]]<<std::endl; Every Answer will be helpful, thanks in advance!! https://code.sololearn.com/c64h20CyxTwm/?ref=app Edit: got some answer, as + is commulative these ptr operations are legal, they are nothing but a alternate way to write program, correct me if I'm wrong Ptr[x] = *(ptr+x) which is equal to *(x+ptr ) = x[ptr]

14th Sep 2019, 6:02 AM
Satyam Mishra
Satyam Mishra - avatar
1 Answer
+ 2
int ptr[2][3]={1,2,3,4,5,6}; cout<<2[ptr[1]]<<ptr[1][2]<<endl; From the above code you can see that - Array[1] =1[Array].
14th Sep 2019, 6:38 AM
Kuri
Kuri - avatar