Created
August 7, 2013 08:29
-
-
Save nazrdogan/6172263 to your computer and use it in GitHub Desktop.
Global Variable
This file contains 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
// declaration of g_nValue | |
int g_nValue = 5; |
This file contains 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
#ifndef GLOBAL_H // header guards | |
#define GLOBAL_H | |
// extern tells the compiler this variable is declared elsewhere | |
extern int g_nValue; | |
#endif |
This file contains 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 "global.h" | |
int main() | |
{ | |
g_nValue = 7; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment