C Programming - Declarations and Initializations - Discussion

Discussion Forum : Declarations and Initializations - Yes / No Questions (Q.No. 3)
3.
Global variable are available to all functions. Does there exist a mechanism by way of which it available to some and not to others.
Yes
No
Answer: Option
Explanation:
The only way this can be achieved is to define the variable locally in main() instead of defining it globally and then passing it to the functions which need it.
Discussion:
11 comments Page 2 of 2.

Shalvi Rathi said:   1 decade ago
We cannot use a non static variable in a static method, hence if we define a method static and the global variable non static, then can't we implement what is referred to in the question?


Post your comments here:

Your comments will be displayed after verification.