Local variable shadows global variable. : Local variable « Language « C Tutorial






#include <stdio.h>

int i =0;            //Global variable
main(){
    int i ;                 // local variable
    void f1(void) ;        
    i =0;                  
    printf("value of i in main %d\n",i);  
    f1();                                 
    printf("value of i after call%d\n",i);
}
f1(void)                      
{
    int i=0;         
    i = 50;          
}
value of i in main 0
      value of i after call 0








1.10.Local variable
1.10.1.Local variable shadows global variable.