Pointer to x or y element of CPoint

Assuming that I have an array of points with type CPoint.
CPointArray arrpt; //arrpt is an array of points
CPointArray* parrpt = &arrpt;
Now can I have the pointer to x or y element of that array from parrpt?
It is something like this (parrpt ->x) or (parrpt ->y).
It's an array right? So it'll be something like:
 
(*parrpt)[i].x
Yes, it is an array.
To make it simple, lets consider the example below:

CPoint arr[10];

Now arr is an array name and in most case it is a pointer to the first element of the array.
What is the pointer to the second member (y) of the array?


arr is the pointer to the first CPoint element of the array.
Is it also the pointer to the x member of the first element of the array?
What is the pointer to the y member of the first element of the array?
It is not "arr + 1" because "arr + 1" is the pointer to the second element of the array.


What is the pointer to the second member (y) of the array?

Pointer to second element of array is (arr + 1).
y member of second element of the array is (arr + 1)->y (or arr[1].y)
Address of y member of second element of the array is &((arr + 1)->y) (or &(arr[1].y))
Topic archived. No new replies allowed.