When is memory allotted to static variables in C++

Viewed 18014

I am a newbie to C++ and facing a problem.

I read in a book that memory is allotted to a static variable, once the object is created of that class. Now, what if I make this static variable global ? When would be it initialized in that case ?

Plus, I have also read in some articles that static variables are allotted on heap and they dont rely on the construction of objects...is this true ? If yes, please explain the memory initialization steps to me, I need help.

Thanks a lot !

3 Answers
Related