What does static variable mean?

Showing Answers 1 - 16 of 16 Answers

sai sudhakar

  • Aug 19th, 2007
 

In C++, variable declared as static it is shared by all the objects of the class. It can be accessed only by a static function.

  Was this answer useful?  Yes

irfan.omair

  • Jul 15th, 2010
 

Yes it is shared by all the objects of the class. Static member variable are always stored in data area of the program so it gets its place even before main is called.

It can be refered by  operator too. There is no need to have any object it can be accessed through :: too, It does not mean that it cannot be accessed by an object though.

  Was this answer useful?  Yes

vignesh

  • Feb 10th, 2017
 

A function-scope or block-scope variable that is declared as static is visible only within that scope. Furthermore, static variables only have a single instance. In the case of function or block-scope variables, this means that the variable is not "automatic" and thus retains its value across function invocations.

  Was this answer useful?  Yes

supriya

  • May 24th, 2017
 

static variable is used with in class in anywhere.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions