How can I access arrays of structures using pointer arithmetic?
Suppose I have a structure
struct point{
int x;
int y;
}collection[100];
Suppose I have a function
int func(struct point *collection,int size)
Inside this function, I access the element as shown below.
collection[0].x
Is it the same as *(collection + 0).x? Since the operator .has a higher priority than the operator *, the collection pointer is first incremented by 0, and the point operator is applied, and then the pointer is played? One way or another, it does not make sense; any refinement is appreciated.
source
share