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

Explain what are its uses in c programming?

0 Answers  


Snake Game: This is normal snake game which you can find in most of the mobiles. You can develop it in Java, C/C++, C# or what ever language you know.

7 Answers   Accenture, Gridco, IBM, Kevin IT, TCS, Vimukti Technologies,


Write a program to reverse a string.

0 Answers   Global Logic, iNautix, TCS, Wipro,


What are the types of data files?

0 Answers  


What are the string functions? List some string functions available in c.

0 Answers  






What are near, far and huge pointers?

0 Answers   Hexaware, Thomson Reuters, Virtusa,


What does a run-time "null pointer assignment" error mean?

2 Answers  


Write the following function in C. stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return - 1. The function should not make use of any C library function calls.

3 Answers   Google, Infosys, JTL, OpenFeel,


write a program that print itself even if the source file is deleted?

2 Answers  


How to use c/c++ code in JAVA

10 Answers   CDAC, IBM, Satyam, Scope International,


wite a programme in c to linear search a data using flag and without using flags?

3 Answers   TCS,


Why doesn't C support function overloading?

2 Answers  


Categories