Toshiba Interview Question

Scope of a static variable?

Interview Answer

Anonymous

Sep 24, 2017

There are two types of specifier in c language i.e Access Specifier and Data Specifier. For Access Specifier, we have four storage class which are Extern, Static, Auto, Register. For Data Modifier we have Volatile and Constant. For these types of variables, we need to see the scope and lifetime of them. In case of, Static variable it has scope within the function or file and lifetime has until the program ends. As the name implies, if any variable is declared as static, it has the access within the function or file but the value is retained until the termination of the program.

2