With C, static variables can be only initialised with constant values but function parameters are not constant.
The solution is quite simple in your case. Split the command into an initialisation and an assignment:
void f(int c) {
static int foo = 0;
foo = c;
}