I have a simple question about static variables. If I declared a static variable in a function:
void main()
{
int k = 0
while(k<=4)
{
fun();
k++;
}
}
int fun()
{
static int i=5;
i++;
printf(Value %d\t", i);
return 0;
}
As I know, the function will deallocate after returning. But where is the i
value stored. Is a static variable like a global variable.