Pointers
An array is not a pointer.
It is very important that we ignore statements to the effect that a pointer and an array are the same thing.
They are not. In some circumstances, the notation is equivalent. Equivalent is not equal, despite the common root word. Some South Sea islanders once rolled around giant stone wheels for currency — the equivalent of, but not the same thing as, our pocket change. We spent some time in the preceding section discussing the syntactical similarities in using the two. There are additional pitfalls. To reiterate one of the points there: given the array above, we may write,
value = iArray [2];
value = pArray [2];
and assign the very same value, it's obvious that the array, iArray, and the pointer, pArray, are the same thing. Right? Duck!! Confustoid!!! Despite the identical expressions, they are not the same thing. The compiler can tell the difference between an array and a pointer because of the declarations. By convention it treats the two as equivalent for this method of expression.
If one examines the emitted code for each statement, one will discover that it is not the same. Again, our compiler is ‘just’ helping (and perhaps hindering the new among us). When applied to a pointer, the array notation adds a dereferencing step prior to applying the pointer arithmetic. Perhaps it should be written,
value = *(pArray+2);
ConfustoidsPointer Arithmetic