what does it mean to declare a member variable as a static, C/C++ Programming

b) The static keyword let a variable to maintain its value among distinct function calls.

If the value of a static variable alters while the variable has been accessed, variable keeps the new value. If the identical variable gets accessed again, it would be storing its most recent value. It is possible because, while the static variable is declared, the compiler employee a separate memory area to hold it. By doing this, while the value of the static variable gets altered, it is updated in the memory it is occupying. And since this memory is separate, the compiler can check its values even whilst its function exits.

 

Posted Date: 3/21/2013 7:37:25 AM | Location : United States







Related Discussions:- what does it mean to declare a member variable as a static, Assignment Help, Ask Question on what does it mean to declare a member variable as a static, Get Answer, Expert's Help, what does it mean to declare a member variable as a static Discussions

Write discussion on what does it mean to declare a member variable as a static
Your posts are moderated
Related Questions
It''s that spooky time of year when the dead walk the Earth, things go bump in the night, and the Centers for Disease Control (CDC) recognizes the need for zombie preparedness (

Available, and the right kind of programs. My son wants to stop using ice. He has organised detox a number of times, and is always successful. It is the next stage, rehab, where

Can copy constructor admit an object of the same class as parameter, rather than reference of the object?

write a program that counts the number of occurances of the string in the n-th padovan string p(n)

Write a program that does the following: Calculates the Velocity and Momentum of an object. The formula for the velocity is V=d/t and the formula Momentum is m=mass*velocity. Your

A: They present a degree of freedom in the interface design options. Member functions & friend functions are equally privileged (100% vested). The major difference is that a fri

Precautions with function overloading Function overloading is a boon to designers, since dissimilar names for same functions need not be thought of, which often is a cumbersome

How do you declare an integer variable? Explain with an example.


The size of () operator This is a pseudo-operator given by the language, which returns the number of bytes taken up by a variable or data type. The value returned by this opera