0 votes 0 votes How p+i = &(i[p]) Please explain someone. saif asked Jan 17, 2019 saif 362 views answer comment Share Follow See all 6 Comments See all 6 6 Comments reply Ashish Goyal commented Jan 17, 2019 reply Follow Share Remember, for an array => ar[2] = *(ar+2) So, in general, [] operator is expanded like this.... this means you can even write ar[2] as 2[ar] (since, ar+2 = 2+ar). 0 votes 0 votes saif commented Jan 17, 2019 reply Follow Share Bro, please explain the above one in detail 0 votes 0 votes Ashish Goyal commented Jan 18, 2019 reply Follow Share @saif, Please go on and read the pointers topic from here- https://www.geeksforgeeks.org/pointers-in-c-and-c-set-1-introduction-arithmetic-and-array/ This would help in clearing your understanding. 0 votes 0 votes saif commented Jan 20, 2019 reply Follow Share @Ashish Goyal See, I know that p[i]= *(p+i)= i[p] But now i[p] will give us a value which is stored at ith location in p array. After that how can we apply the '&' operator to a value? As far as I know, we use '&' operator with a variable which is storing some value in order to obtain its address where it is stored in memory. please correct me where I am wrong? 1 votes 1 votes Ashish Goyal commented Jan 22, 2019 reply Follow Share @saif, Thanks for clarifying, your doubt is a valid one. See, a variable also represents a value like if a is holding value 5, then a+3 means 5+3, and we can write '&a' right?. So why not with the array notation. If u try to print &a and &(*(&a)) , you will get the same result. This is how a compiler behaves, when referring a value of variable, it never directly replaces with the current value as the value of variable may change in runtime. It just holds the address where the value is stored and the info whether we need the 'value at address' or the address itself. I hope it clears your doubt. 0 votes 0 votes saif commented Jan 22, 2019 reply Follow Share Yes, Thanks, @Ashish Goyal 1 votes 1 votes Please log in or register to add a comment.