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

C Program for DIVISER   void main() {           int result,number,min;           clrscr();           printf("ENTER THE NUMBER=");           flushall();

Problem 1 What is the difference between function declaration and function definition? 2 Write a recursive function to find sum of even numbers from 2 to 10. 3 List some

Question: (a) A bank has four types of accounts with annual interest rates as follows: Savings 8% Savings with Cheque Book 5% Current 4% Fixed deposits 10% Using


Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve betw


what is an array?

Syntax rules for writing a destructor function Its name is the similar as that of the class to which it belongs, except that the first character of the name is the symbol t

Imagine that the server program is a setuid program owned by the root, then after you penetrate the program with a shell running, you become the ROOT and you can remove the whole f