In the following code, 2 is printed.
int x = 1;
int f(int y)
{
    return x;
}
int main() {
    x = 2;
    printf("%d", f(0));
}
How is it happening if we have static scoping in C? Why isn't 1 printed?
Printing 2 in this case isn't a dynamic scoping, is it?
I thought that in static scoping it should take the nearest x to the function definition.
 
     
     
     
     
    