How to access global variable when there is a local and global conflict
c, global-variables
Solution
How about this old trick:
int main()
{
int a = 40; // local variables always win when there is a conflict between local and global.
{
extern int a;
printf("%d\n", a);
}
}
Problem
Code : ``` int a = 33; int main() { int a = 40; // local variables always win when there is a conflict between local and global. // Here how can i access global variable 'a' having value '33'. } ``` If you ask : Why would someone want to do above thing? Why [a-zA-Z]* ? My answer would be : Just to know that 'it is possible to do so'. Thanks.