Skip to content

Instantly share code, notes, and snippets.

@itsmemattchung
Created April 7, 2017 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsmemattchung/3fab543b80976389059f9ec9d8aded15 to your computer and use it in GitHub Desktop.
Save itsmemattchung/3fab543b80976389059f9ec9d8aded15 to your computer and use it in GitHub Desktop.
What's going on in memory?
#include <stdio.h>
int main(){
printf("a = %d\n", a());
printf("a = %d\n", a());
printf("a = %d\n", a());
printf("b = %d\n", b());
printf("b = %d\n", b());
printf("b = %d\n", b());
}
int a(){
static int i = 0;
return ++i;
}
int b(){
int i = 0;
return ++i;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment