I just need a way to restrict access of a global variable per my functions in C not C++
static int global_int = 10;
int main(void)
{
global_int = 20; // allowed
}
void f()
{
global_int = 30; // global_int cannot be used here
}
What does I mean is, having more functions in a translation unit, I need to prevent some functions to access the global variable and allow some other function; instead of defining this variable in each function uses this variable.