View previous topic :: View next topic
|
Author |
Message |
donateeye Warnings : 2 New User
Joined: 01 Jun 2007 Posts: 62 Location: chennai
|
|
|
|
If I have a main proc called M,
In M, I have A proc and B proc.
Now, if I declare a variable 'x' in A proc as Static. Can I use it in the main proc M without having declared it in M ??
If not, then please let me know, is there anything like global variable where the above should be possible.
Please advice. |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
No.
Variables are only know in the procedure in which they are declared and in all procedures contained in that procedure. Whether they are STATIC or AUTOMATIC has absolutely no relevance.
If you want a global variable, declare it in the outermost block, and it will be visible in all internal procedures, unless any of the internal procedures declares a variable with the same name, in which case you have no way of accessing the same named variable in the outer procedure. |
|
Back to top |
|
|
donateeye Warnings : 2 New User
Joined: 01 Jun 2007 Posts: 62 Location: chennai
|
|
|
|
Great... Thanks a lot Prino |
|
Back to top |
|
|
|