Variables in c language

 Variables -

A variable is defined as the name given to a memory location. Where  the data 
Can be store accessed or manipulated in which is used to store a value is called variable.
 


There's two types -

1. Internal/local variable 
2. External/Global variable 


1. Local variable -

Local variables are declared inside a 
Particular functions. They are local to particular functions. They are declared inside a function. In which they are to be initialized . They are private property 
Of a particular function and can not be 
Exit outside.

Example-
  #included <stdio. h>
    Void main()
{
  Int a=10;
Printf("value of a");
getch();
}

Global variable -

Global variable declared outside the function. They can use in whole program.

Example -
#included <stdio. h>
    Void main()
Int a=20;
{
a =10; 
Printf("value of a");
getch();
}

No comments:

Post a Comment