gameState state; state.pile1 = 5; state.pile2 = 8; clear(&state);This says that the address of the struct, rather than the struct itself, is being passed.
The type signature of clear must be changed accordingly. You can use
either:
void clear(gameState *g)
or
void clear(gameState* g)