Search the Whole World Here.,.,

C - Variables



1. Variable in C Programming is called as container to store the data.

2. Variable name may have different data types to identify the type of value stored.

3. Suppose we declare variable of type integer then it can store only integer values.

4. Variable is considered as one of the building block of C Programming which is also called as identifier.

5. A Variable is a name given to the memory location where the actual data is stored.



Following are the types of variable in C :

  • Local Variables
  • Global Variables


Local Variables

    1. Local Variable is Variable having Local Scope.

      2. Local Variable is accessible only from function or block in which it is declared.

        3. Local variable is given Higher Priority than the Global Variable.



        Global Variables

        1. Global Variable is Variable that is Globally available.

        2. Scope of Global variable is throughout the program [ i.e in all functions including main() ]

        3. Global variable is also visible inside function , provided that it should not be re-declared with same name inside function because "High Priority is given to Local Variable than Global".

        4. Global variable can be accessed from any function.

        Ads by Google