Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Declare a Global variable

Status
Not open for further replies.

RADM

Programmer
Dec 27, 2003
36
0
0
IT
hi,

how to declare a global variable without using a class? can anyone give me a solution?

Rgs,

RADM
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top