application of static variables in real time



application of static variables in real time..

Answer / venugopal

ya.. well before going to know the static variable u need to know the diff b/w static and general variable.
in case of general variable every object have own memory.In case of static variabale all objects share the static data members.
so conclusion is:general members hv own memory so there is no relation b/w one object data to other object data .Static data it maintains relation

uses:
when we open some websites in the homepage we found "hits".It denotes how many users open this site so far.so the "hits" is a integer type we declare it as a static member when i try to open the site my browser acts as a one object and increment the hits value and other person open the site the same increment variable is accessed by other person. my id: venugopal.palavalasa@gmail.com

Is This Answer Correct ?    4 Yes 2 No

Post New Answer

More C Interview Questions

print the following using nested for loop. 5 4 3 2 1 1 2 3 4 3 2 1 1 2 1 2 1 1 2 3 4 3 2 1 1 2 3 4 5

7 Answers   IBM,


What is conio h in c?

0 Answers  


program to find the magic square

1 Answers   Infosys,


i want to have a program to read a string and print the frequency of each character and it should work in turbo c

3 Answers   Persistent, Wipro,


related proverb of "dont count your chicken before it hatches"

1 Answers  


what is the function of void main()?

8 Answers  


What are the difference between a free-standing and a hosted environment?

0 Answers   Infogain,


Write a c program to sort six numbers and find the largest one by using the ladder of if-else? plz do help me

2 Answers  


What is the most efficient way to count the number of bits which are set in a value?

4 Answers  


write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays

0 Answers   IBM,


2. What does static variable mean?

2 Answers  


diff between exptected result and requirement?

0 Answers   HCL,


Categories