Are global variables automatically declared as static and initialized to 0? What ANSI says about this?
Thanks for any answer!
Printable View
Are global variables automatically declared as static and initialized to 0? What ANSI says about this?
Thanks for any answer!
>Are global variables automatically declared as static and initialized to 0?
If by global variable you mean this:
Then yes, the standard guarantees that a will have static linkage and be initialized to 0.Code:int a; // Global
int main()
{
...
}