Static

Static will preserve the state outside of a function

main() {
  static_counter();
  static_counter();
  static_counter();
  static_counter();
}

void static_counter() {
  static int counter = 0;
  ++counter;
}
Written on October 13, 2017