g.pile1to access a member. We have to dereference the pointer first.
However,
*g.pile1
will not work because the member operator '.' has higher precedence
than '*'.
So
(*g).pile1
will work. Now,
void clear(gameState *g) { (*g).pile1 = 0; (*g).pile2 = 0; } |
will succeed in modifying the original struct.