Pointers with c++ [duplicate]

Literally i can use a[i] or p1[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).

Leave a Comment