Give one real time application where static variables are used?

Submitted by: Administrator
Thinks of a situation where you need to do some work just once in a function irrespective of how many times that function is invoked then u can have a static variable which will keep a track of it. eg int main () { static int once = 0; if (!once) { once++; /*code need to be executed once*/ } /*reset of the code*/ }
Submitted by: Administrator

Read Online Programming Concepts Job Interview Questions And Answers