previous | index | next

The Structure Pointer Operator

To make programs slightly easier to read, you can replace
  (*g).pile1
with
  g->pile1
'->' is an operator that takes the pointer preceding it and dereferences it before applying the member operator.

So we can rewrite the function as:

void clear(gameState *g) {
  g->pile1 = 0;
  g->pile2 = 0;
}


previous | index | next