previous | index | next

Passing Structs to Functions

Consider a similar situation with a struct:

struct gameState {
  int pile1;
  int pile2;
};

void clear(gameState g) {
  g.pile1 = 0;
  g.pile2 = 0;
}

Will this work? That is, can a caller of clear expect the original struct to be modified?


previous | index | next