the question is can we call variable A “global variable”? From the one hand A is static global variable, so it is global by definition, from the other global variable must be available in every point of your program, not only in the current translation unit. Thanks.
#include<stdio.h>
static int A;
void main()
{
...
}
No, a
staticis not a global because it has internal linkeage. A copy will exist for each TU that defines it.Why is it a static global variable? It’s
static, yes, but that’s about it.Global variables in C++ are those declared
externand defined only once, or contained asstaticmembers (which has a whole different meaning).