What is the difference between declaring static variable inside a block and outside a block in a file? Eg, here, what is difference between static variables a,b,c,d? Can we
static int a;
means the variable a
is a file scope variable, i.e, it can't be seen from other files.
void getVol(..)
{
static int b;
}
means the local variable b
has a life cycle that goes from the program starts to the program ends, i.e, you can assign it some value, while on the next call of the function, it remembers that value.
c
and d
are similar to b
.