what is the scope of static variable?


static global: scope is within the file.
static local: scope is only for the function but it retains value of the variable and same is value available on next function call.

In C, a variable declared as static in a function is initialized once, and retains its value between function calls. The default initial value of an uninitialized static variable is zero.

If a function or global variable is declared static, it can only be accessed in that file.