answersLogoWhite

0

What is meant by a static variable?

User Avatar

Anonymous

13y ago
Updated: 8/19/2019

A static variable has load module lifetime. Its value persists until changed or the program exits.

If the variable is at file scope, i.e. outside of any block, the word static means that it is visible only to code within that compilation unit, i.e. it can not be linked by other compilation units.

In a C++ class, a static variable is common to all instances of the class.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

What is meant by static identifier?

Nothing. I guess you mean a static variable.


What is meant by the storage class of a variable?

auto, extern, static, register, typedef (only formally)


What is the difference between a static variable a global variable and a local variable?

A static variable is a variable allocated in static storage. A local variable is a variable declared inside a function. A global variable is a variable declared outside of any class or function. Note that local variables and global variables can both be allocated in static storage.


Scope of static variables?

Scope of static variable is with in the file if it is static global. Scope of static variable is with in the function if variable is declared local to a function. But the life time is throughout the program


How do you create static variables in PHP?

Use the "static" keyword to declare a static variable within a function like shown below. <?php function fun() { static $variable; static $another_variable = ''; } ?>


Why use static variable in programming language?

For C programming, the use of a static variable has two uses: One reason is to hide the variable from other modules. The scope of the static variable is limited to the compilation unit that it is described in. The second use of a static variable is to keep the value of the variable intact through the entire program execution unit.


Can static variable be used inside a static method?

Yes.


WAP to show the difference between a variable and static variable?

difference between constant and static variables in java


What is the static variable in the class in c?

A static member variable is local to the class rather than to an object of the class.


What is static variable and how it is declared?

static variables are declared to define a variable as a constant., means if you declare a variable as static the variable becomes costant.syntaxstatic int a=100;this will make the value of a as 100 which is not to be changedWell, no; you think of 'const', which can be used together with static, but not necessarily.Yes you are right bro I was confused it should be const int a=100; then the variable will be a constant.


Why static variables in a function have global extent?

A variable declared static outside of a function has a scope the of the source file only. It is not a global variable. A variable declared outside of a function and without the static qualifier would be a global variable.


Will multiple JVMs running the same application containing a static variable hold individual copies of that static variable?

Yes