I am trying to understand how pointers work but I do not know how a pointer to only the first element can be used to access all the array
int myArray[10];
for(int i=0; i<10; i++)
{
myArray[i] = 11*i;
}
int *p;
p = myArray;
//Now how do I access the complete array using the variable p
cout<<*p; //This only prints the first value, how to print all the values
p = myArrayperforms array-to-pointer conversion onmyArray. This results in a pointer to the first element. If you want a pointer to the whole array, you have to doint (*p)[10] = &myArray;, but you cannot print out a full array withcoutlike this.