Static Variable in C


Static variables have a property of preserving their value even after they are out of their scope!Hence, static variables preserve their previous value in their previous scope and are not initialized again in the new scope.

Source Code

//Static Variable
 
#include<stdio.h>
 
void display();
 
 
int main()
{
    display();
    display();
    display();
}
 
void display()
{
    static int x=1;
    x++;
    printf("\nx : %d",x);
}
 
To download raw file Click Here

List of Programs


Sample Programs


Switch Case in C


Conditional Operators in C


Goto Statement in C


While Loop Example Programs


Looping Statements in C

For Loop Example Programs


Array Examples in C

One Dimensional Array


Two Dimensional Array in C


String Example Programs in C


Functions Example Programs in C


Learn All in Tamil © Designed & Developed By Tutor Joes