>
> Hi Vijay,
>
> When i was automating a tool i came across with a situation
> where i could not able to get the solution. So i thought of
> sharing it with
> you. Could you please let me know the solution for this situation?
>
>  Situation: There is a global variable named "param" of integer type.
> One more local variable of same name with same data type
> exists in a function.
> So how can i access the global parameter in this function?
> In the below example it should print 20 on the console instead of 10.
>
> # include <stdio.h>
> int param = 20;
> int main(void)
> {
>  int param = 10;
>  printf("%d",param);
>  return 0;
> }
>

#include <stdio.h>

int param = 20;

int main(void)
{
    int param = 10;
    {
        extern int param;
        printf("Global param value: %d\n",param);
    }
    return 0;
}

D:\Vijay\C> gcc param.c -Wall
global-local.c: In function 'main':
global-local.c:7: warning: unused variable 'param'

D:\Vijay\C> a.exe
Global param value: 20