answersLogoWhite

0


Best Answer

There are three meanings to the static attribute in C++

First of all, static means that the variable has run-time persistance. It will retain its last value, i.e. until changed, until the program exits.

Second, if the variable is defined at file scope, i.e. outside of all blocks, then its scope or visibility willonly be within the file that it is contained within.

Last, if the variable is a static member of a class, then it has common value and storage amongst all instances of that class.

User Avatar

Wiki User

βˆ™ 14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is a static varialble in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Static vs dynamic binding in c plus plus?

Static binding occurs at compile time. Dynamic binding occurs at runtime.


What is storage classes in c plus plus?

AUTO EXTERN STATIC are the storage classes in c++


Difference between procedure and function in C or C plus plus or Java language?

In C there are functions only, In Java methodsonly (static methods as well), in C++ both.


What is meant by 'static' in C plus plus?

Static in C/C++ means that the variable will keep its value across calls to the function. ex: func() { static int x=0; ++x; cout << x << endl; } main() { func(); func(); func(); } This will print: 1 2 3 *NOT* 1 1 1


How do you write a program in c plus plus in which static variables are declared?

#include <stdio.h> static int myvar1, myvar2; int main (void) { puts ("It was easy"); return 0; }


Does c and c plus plus support static or dynamic binding?

Yes and no. Static vs dynamic binding is not a C or C++ language issue; it is a linker issue. If you link with a .lib file that contains stubs for run-time loading, then the called routine will not be loaded until it is invoked, and it will not be made a part of the load module.


What is static variable in the class for c plus plus?

Static member variables are local to the class. That is, there is only one instance of a static member variable, regardless of how many objects are instantiated from the class. As such, they must be declared inside the class, and defined outside of the class.


Can you overload static functions in c plus plus?

Yes, but overloads cannot differ by return type alone. The signatures must differ by the number and/or the type of the arguments.


How is dynamic initialisation achieved in c plus plus?

The C++ standard has this to say about dynamic initialisation:"Objects with static storage duration shall be zero-initialised before any other initialisation takes place. Zero-initialisation and initialisation with a constant expression are collectively called static initialisation; all other initialisation is dynamic initialisation."


What is the definition of the term C static?

The term C static is a variable within computer programming in particular C Language. When set static the variable inside a function keeps its value between invocations.


What is b plus b plus b plus c plus c plus c plus c?

b+b+b+c+c+c+c =3b+4c


What is c plus c plus 2c plus c plus c equal?

c + c + 2c + c + c = 6c