Skip to content

Instantly share code, notes, and snippets.

@Jay-flow
Last active June 25, 2020 11:23
Show Gist options
  • Save Jay-flow/2b8a3bdb3074efc5611eca72e46a171d to your computer and use it in GitHub Desktop.
Save Jay-flow/2b8a3bdb3074efc5611eca72e46a171d to your computer and use it in GitHub Desktop.
How the computer handles variables
#include <stdio.h>
void addValue() {
// It doesn't reset every time I call.
static int a = 10;
a = a + 10;
printf("%d\n", a);
}
int main(void) {
addValue()
addValue()
addValue()
addValue()
// a = 50
system("pause");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment