I faced the following code problem. When I run this code in Mac, I get the output as 1 2. However, on Linux command line, the output is 2 2. Can anyone please explain why this may be happening?
struct point
{
    int x,y; 
};
void foo(struct point p[])
{
    printf("%d %d", p->x, ++p->x);
}
int main()
{
    struct point p1[ ] = {1, 2, 3, 4}; 
    foo(p1);
    return 0;
}
 
    