vincegata wrote: |
---|
So, pointer p is a pointer to an array |
No, p is a pointer to the first int in an array, which is very different from being a pointer to an array like p2.
vincegata wrote: |
---|
Pointer p2 is a pointer to an array of ten integers. What is it for, how can I use it to access elements of arr? |
1 2
|
(*p2)[index] = blah;
std::cout << (*p2)[index] << std::endl;
|
Last edited on
I do not have initialization, I saw the syntax for p2 and I wanted to know what is it for.
Thx for clarification.
I do not have a "proper" initialization. I only saw the syntax for p2 and I wanted to know what is it for.
I know, I'm just pointing out to you that you cannot determine how to use a variable solely from its syntax.
Neither of those explains whether the pointer to the array can be incremented to access a different array.