Jul 8, 2006 #1 RADM Programmer Dec 27, 2003 36 IT hi, how to declare a global variable without using a class? can anyone give me a solution? Rgs, RADM
Jul 8, 2006 #2 xwb Programmer Jul 11, 2002 6,828 GB Just put it at module level i.e. not within any routine/class/namespace eg Code: int aGlobalVariable; int main () { int aLocalVariable; return 0; } If you wish to use it in another module, declare it in a header as extern and declare the physical instance in one of the source files. Upvote 0 Downvote
Just put it at module level i.e. not within any routine/class/namespace eg Code: int aGlobalVariable; int main () { int aLocalVariable; return 0; } If you wish to use it in another module, declare it in a header as extern and declare the physical instance in one of the source files.