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
I am doing project on home stay which includes features like add homestay,search,book,delete homestay,


Prepare a program to obtain prime factors of any integer number using functions

Write a C program to input your full forename and full surname. e.g James McCarren and display in one string your complete initial and surname i.e J McCarren . Your initial should

plaese tell the full program for the above given topic with the input and output

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

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 between two points can b

A: By keeping along with the C++ tradition of "there's more than one method to do that" (translation: "give programmers options & tradeoffs so they can choose what's best for them


Write a C program to input 16 numbers and print them out in a table format of 4 wide by 4 deep. E.g.   4    5    5    7   8    9    10    11   12    13    14    15   16    17