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

Write a C program to print 1 2 3 ... 100 without using loops?

15 Answers   Hindalco,


What is meant by global static? why we have to use static variable instead of Global variable

4 Answers   L&T,


Tell me is null always defined as 0(zero)?

0 Answers  


struct node { int *a; char *b; char array[12]; }; struct node m,*n; assign the value in *a,*b,char array[12]

3 Answers  


What are the uses of pre-processor directives?

2 Answers  






How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?

0 Answers  


long int size a) 4 bytes b) 2 bytes c) compiler dependent d) 8 bytes

18 Answers   Acropolis, HCL, Intel, TCS,


the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset

0 Answers  


Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)

0 Answers  


what is the difference between char * const and const char *?

2 Answers   TCS,


Can a file other than a .h file be included with #include?

0 Answers   Aspire, Infogain,


Write a C/C++ program that connects to a MySQL server and checks intrusion attempts every 5 minutes. If an intrusion attempt is detected beep the internal speaker to alert the administrator. A high number of aborted connects to MySQL at a point in time may be used as a basis of an intrusion.

2 Answers   Drona Solutions, Infosys, Vodafone, Webyog,


Categories