I would like to ask if there could be any problem in passing a static variable to a function by reference, in order to let that function modify the variable. A stupid example is:
void increment (int *b)
{
    *b = *b + 1;
}
void f()
{
   static int a = 4;
   increment(&a);
   printf("%d\n", a);
}
int main()
{
   f();
   f(); 
   f();
   return 0;
}
I executed it and it seems to work fine, printing
5
6
7
but I would like to understand if this is a sort of "bad" programming practice, that is preferable not to do.
 
    