I need the following quote especially the bold text , to be justified.
... This would tend to imply that somehow
source[i]
is the same as*(p+i)
.In fact, this is true, i.e wherever one writes a[i] it can be replaced with
*(a + i)
without any problems.In fact, the compiler will create the same code in either case. Thus we see that pointer arithmetic is the same thing as array indexing. Either syntax produces the same result. This is NOT saying that pointers and arrays are the same thing, they are not. We are only saying that to identify a given element of an array we have the choice of two syntaxes, one using array indexing and the other using pointer arithmetic, which yield identical results.
This is quoted from the pdf
A TUTORIAL ON POINTERS AND ARRAYS IN C by Ted Jensen Version 1.2 (PDF Version) Sept. 2003 P.No : 19