Switch to Bing in English
About 84,900 results
Open links in new tab
  1. c++ - How to declare a global variable that could be used in the …

    Jan 8, 2010 · The below solution should be simple enough as per the title "How to declare a global variable that could be used in the entire program " . If you want to use it in a different file then …

  2. When to use static keyword before global variables?

    Can someone explain when you're supposed to use the static keyword before global variables or constants defined in header files? For example, lets say I have a header file with the line: const f...

  3. C++ Global variable declaration - Stack Overflow

    22 A more C++-like way would be using a class member, syntactically indicated by the static keyword. Class member variables have implicit external linkage.

  4. How to declare a global variable in C++ - Stack Overflow

    Mar 14, 2012 · How to declare a global variable in C++ Asked 13 years, 10 months ago Modified 7 months ago Viewed 451k times

  5. c++ - How do I use extern to share variables between source files ...

    Best way to declare and define global variables The clean, reliable way to declare and define global variables is to use a header file to contain an extern declaration of the variable. The …

  6. static and extern global variables in C and C++ - Stack Overflow

    108 Global variables are not extern nor static by default on C and C++. When you declare a variable as static, you are restricting it to the current source file.

  7. When to use extern in C++ - Stack Overflow

    Thank you. So, if i declare a global variable in an header file without the extern keyword, the source files that include the header does not see it?

  8. variables - extern and global in c - Stack Overflow

    16 From Here: A global variable in C/C++ is a variable which can be accessed from any module in your program. int myGlobalVariable; This allocates storage for the data, and tells the compiler …

  9. What's the scope of the "using" declaration in C++?

    Oct 22, 2008 · 8 The scope is whatever scope the using declaration is in. If this is global scope, then it will be at global scope. If it is in global scope of a header file, then it will be in the global …

  10. C/C++ global vs static global - Stack Overflow

    Possible Duplicate: Static vs global I'm confused about the differences between global and static global variables. If static means that this variable is global only for the same file then why ...