Saturday, May 22, 2010

Is there any difference b\w a[i] and i[a] in c++? a is the name of an array , i is any integer?

big difference. a[i] means element i from array a, but i[a] means element a from array i. Since a is the array, you want to use a[i].

Is there any difference b\w a[i] and i[a] in c++? a is the name of an array , i is any integer?
a[i] denotes the i th element of the array a.





i[a] denoted the a th element of the array i.
Reply:both mean the same.. internally it gets converted into *(i+a)


so if it is a[i] or i[a] it is finally equal to *(i+a)...


hope u got it..


No comments:

Post a Comment