+ 1
Do you know the difference between global and external variable scope?
Example for explaining why they are what they are, would greatly help.
3 Answers
+ 3
avik arefin local variable are available within function scope:
for example,
in fun1()
{
int a;
}
Here, int a is local to function and is accessible within function , not outside the function.
Now coming to global variable... if you declare variable outside main i.e. globally, it becomes accessible in the entire code..
extern variable are important when you have more header files..
suppose you declare variable in one class header and get those variables assigned in other class, it is useful..
https://stackoverflow.com/questions/2652545/extern-and-global-in-c
+ 2
Happy learning...
+ 1
Ketan Lalcheta Thanks for the link.