Storage Classes in C: by Pundreekaksha Sharma Assistant Professor
Storage Classes in C: by Pundreekaksha Sharma Assistant Professor
By
Pundreekaksha Sharma
Assistant Professor
void main(){
fun();
fun();
fun();
}
• The variables defined as static specifier can hold their value between
the multiple function calls.
• Static local variables are visible only to the function or the block in
which they are defined.
• A same static variable can be declared many times but can be assigned
at only one time.
• Default initial value of the static integral variable is 0.
• The visibility of the static global variable is limited to the file in which
it has declared.
• The keyword used to define static variable is static.
• Syntax:
static int a;
void main(){
fun();
fun();
fun();
}
}
fun1(){
int x=1;
x+=5;
printf("x = %d\n",x);
}
int x =20;