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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I make a variable....

Status
Not open for further replies.

Bratan

Technical User
Jul 13, 2008
3
AP
Hi Guys!
Help me, please!!!!!!!!!!!
How can I make a variable known and ready to be used by all complex of C++ files (not just inside a function where I activate the variable)?
 
Declare the variable outside your function to make it global.
 
Also, the suggested way to do it is to declare it globally in a cpp file and where you need it use

extern <type> <variable name>

Declaring it in a .h file can cause problems :)

<Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top