Answers

Question and Answer:

  Home  Programming Concepts

⟩ Give one real time application where static variables are used?

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*/ }

 173 views

More Questions for you: