variable scope
- Posted by Nathan Green <lochlainn10 at hotmail.com> Mar 07, 2003
- 465 views
I have a question regarding variable scopes. Is it possible to declare a variable or constant that is truly global, across all includes? In reading the manuals, I understand the desire to keep scope limited to a routine, but I don't understand the why of limiting to a given include, or an include and the main program, but not a truly global variable or constant across all files. Am I misunderstanding the use of the include files? I want to be able to break my libraries into neat groups, but several of these libraries, distinctly different in my mind, require the same variable. I would rather not have to pass that variable constantly to functions in different files; it's set once and never changes. (A pointer to a bitmap used as a back buffer.) Any clarifications about the scope of variables or how I can get around this? Am I thinking wrongly about the use of include files? Thanks, Nate