Created
May 24, 2014 03:34
-
-
Save pix0r/a670efa812a7f69fec33 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int test() { | |
static int val = 0; | |
val += 1; | |
return val; | |
} | |
int main() { | |
printf("val: %d\n", test()); | |
printf("val: %d\n", test()); | |
printf("val: %d\n", test()); | |
printf("val: %d\n", test()); | |
printf("val: %d\n", test()); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mike@Mike-MBP2:~$ ./static
val: 1
val: 2
val: 3
val: 4
val: 5