Image

C Language - Storage Classes - static storage class

static storage class

Static by default contain zero value, and always static variable initialize once.

WAP to use of static

#include<stdio.h>
#include<conio.h>
void fun();
main(){
clrscr();
fun();
fun();
fun();
getch();
}
void fun()
{
static int x=2,y=5;
int z=3;
printf(" x = %d abd y = %d and z = %d",x,y,z);
x++;
y++;
}

Output


x=2 add y=5 and z=3
x=3 add y=6 and z=3
x=4 add y=7 and z=3