3 ms·
In C/C++ static declarations are local to the compilation unit. So you will have two separate storages for foo - these will be two independent variables. That'
by c-smile 8y ago
In C/C++ static declarations are local to the compilation unit. So you will have two separate storages for foo - these will be two independent variables.
That's how C and C++ work.
And if you will have this (no static):
int foo = 45;
then linker will complain - "multiple 'foo' entities" as non-static entities have global visibility.