Created
September 21, 2012 10:06
-
-
Save BYVoid/3760736 to your computer and use it in GitHub Desktop.
Global variable in multiple files
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
int buf = 0; | |
void func() { | |
buf = 2; | |
/* Do something else */ | |
} |
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 buf; | |
void func(); | |
int main() { | |
buf = 1; | |
func(); | |
printf("%d\n", buf); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment