Literally i can use
a[i]
orp1[i]
?
Yes, dereferencing works the same way for a raw array symbol or a pointer.
The a
symbol in your example will decay to a int*
pointer whenever used as such (p1=a;
).
Using code like p1[i]
is just syntactic sugar for *(p1 +i)
.
2
solved Pointers with c++ [duplicate]