After running this code:
#include int x; int main(void) { printf(\"%d\\n\",x); return 0; } int x=5;
I expected t
Variable default values declared outside of functions get set before main ever runs. So what you are seeing is the correct behavior. Same goes for variables declared in other source files.