Built-in arrays and pointers are intimately related in C++ and may be used almost interchangeably. Pointers can be used to do any operation involving array subscripting.
Assume the following declarations
int b[ 5 ]; // create 5-element int array b; b is a const pointer
int *bPtr; // create int pointer bPtr, which isn't a const pointer
We can set bPtr
to the address of the first element in the built-in array b
with the statement
bPtr = b; // assign address of built-in array b to bPtr
This is equivalent to assigning the address of the first element as follows:
bPtr = &b[ 0 ]; // also assigns address of built-in array b to bPtr
18.224.67.125