Connecting Tech Pros Worldwide Help | Site Map

Using wtatic variables across multiple files?

Newbie
 
Join Date: Dec 2007
Posts: 1
#1: Dec 24 '07
Hi,
here is my question.

Can we use static variable across the multiple files?
If so how?Please reply ASaP.
sicarie's Avatar
Moderator
 
Join Date: Nov 2006
Location: USA
Posts: 3,929
#2: Dec 24 '07

re: Using wtatic variables across multiple files?


That's a very good question. Did you try it? What did you try?
Member
 
Join Date: Aug 2007
Location: Malaysia
Posts: 34
#3: Dec 24 '07

re: Using wtatic variables across multiple files?


Quote:

Originally Posted by vidhey

Hi,
here is my question.

Can we use static variable across the multiple files?
If so how?Please reply ASaP.

You mean you want to use the same variable across different soruce file and its value must be preserved? You didn't specfy C or C++. I assume you mean C. Technically, yes.

The easiest way is to use global variable but it is not advise to use global variable. check it out yourself. And you need the keyword " static" to make its value contained in the variable preserved by the program. Checks the "variable scope".

oh ya..i think the keyword "extend" could help you too. check it out as well.

Hope these will help.
Reply