Originally posted by: glugglug
Originally posted by: arcain
And...
*(3 + p) is equivalent to *(p + 3)...
which means 3[a] is equivalent to a[3].
I doubt that very much, might have to try it.....
*(p+3) figures out that p is an int * and actually adds 3 * sizeof(int) = 12 before dereferencing.
3[a] shouldn't work for several reasons:
1. The compiler will complain that "3" is not a pointer type
2. Even if it treated 3 as a void*, adding the value of "a" as an int wouldn't work unless your array elements are 1 byte each.