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

1. main() { printf("%d",printf("HelloSoft")); } Output?

3 Answers   HCL,


pointer_variable=(typecasting datatype*)malloc(sizeof(datatype)); This is the syntax for malloc?Please explain this,how it work with an example?

2 Answers   eClerx, Excel, kenexa,


If the static variable is declared as global, will it be same as extern?

1 Answers   Samsung,


What is function pointer c?

0 Answers  


Write a program for print infinite numbers

3 Answers   Wipro,






suppose we use switch statement and we intilize years name using enum statement like(jan,feb,mar,------dec) we take integer value as an input .question is that the month which we analyz is from 0 to 11 bt if i enter 12 than how he again starts from begning and print jan

1 Answers  


Write programs for String Reversal & Palindrome check

0 Answers   TISL,


what is diff b/w huge & far & near pointer??

1 Answers   HCL,


Do you know what are the properties of union in c?

0 Answers  


value = 0xabcd; for (loop = 1; (value >> 1) & 1 | loop & 1; loop++) { foo(); if (loop & 1) value >>= 1; } how many times is foo() executed?

6 Answers   Google,


Is javascript written in c?

0 Answers  


What is the difference between realloc() and free()

1 Answers  


Categories