<<< Variable Name Examples     Index     Declaration Is a Statement >>>

21. Scope of Variables


  •  

  • Global variable example:

    
    int count; // global variable
    int main() 
    { 
        count = count + 1; 
        return 0;
    } 
    
    
  •  

  • Local variable example:

    
    int main() 
    {
        int count = 0; // local variable
        count = count + 1; 
        return 0;
    } 
    
    

<<< Variable Name Examples     Index     Declaration Is a Statement >>>