Skip to content

Instantly share code, notes, and snippets.

@nazrdogan
Created August 7, 2013 08:29
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 nazrdogan/6172263 to your computer and use it in GitHub Desktop.
Save nazrdogan/6172263 to your computer and use it in GitHub Desktop.
Global Variable
// declaration of g_nValue
int g_nValue = 5;
#ifndef GLOBAL_H // header guards
#define GLOBAL_H
// extern tells the compiler this variable is declared elsewhere
extern int g_nValue;
#endif
#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