+ 3
Is static variable is subset of global variable ?
What I have observe that global variable functionality is same as static and sometimes beyond it. So, why do we still use static keywords and make program more complex?
2 Respuestas
+ 4
Keywords global and static are not the same.
Global declares global scope of visibility.
Static declares storage class. The scope of a static depends on where and how it is declared.
Storage class can be static, register, extern, or auto. Storage class is part of every type declaration, though if it is not declared, then the default is auto. Storage class specifies whether the item is persistent or temporary. It can be persistent (static) and not global.
+ 1
Brian thanks for the clarification