I have read this question, and I think I've understood the most upvoted answer, but he said
since basically every programming language in wide use today uses lexical scoping
I also heard this from coursera programming language, but here's a simple C code:
#include <stdio.h>
int x = 1;
void fun(){
printf("%d\n", x);
}
void dummy1(){
x = 2;
fun();
}
void dummy2(){
x = 3;
fun();
}
int main(){
x = 4;
fun();
dummy1();
dummy2();
return 0;
}
output:
4
2
3
C++ have exactly the same behavior, so I think C and C++ are dynamic scoped language, are they? And is it real that most programming languages use static scope?