Higher Priority is Given to Local Variables : Accessing Variable in C Programming

Higher Priority is Given to Local Variables

#include<stdio.h>
int num = 50 ;
void main()
{
  int num = 20;
     printf("%d",num);
}

Output :

20

Explanation :

Above program contain two different copies of the variable, One local copy and another global copy. Local and Global Copy have same name.

int num = 50 ;
void main()
{
  int num = 20;
}

Rule :

In C Higher Priority is Given to Local Variables