Bloomberg LP Interview Question
Financial Software Developersall initialized static variables will stored in data part
and all uninitialized static variable (default initialized to 0) are stored BSS..
both data part and BSS are part of data segment.
that's the problem I had with bloomberg, this question is not clear. There are many kinds of static variables, local static, global static and class static and they mean different things in c/c++/java. How am I going to answer this?
in c++ both local static(function scope) and global static are stored in the same place in memory(not registers). Name mangling is done i.e local static var are fgiven a name with their func name and those which are global have file name .
I think it is simply the Heap section since it is the class variable and has class scope.
the heap always stores the dynamically allocated memory. There is always a separate segment of space called data segment where the global and perhaps the static variables are stored. This data segment is different from the code segment of the program and also different from the heap and stack.
Static variables are stored in BSS (Block Started by Sybmbol) segment. BSS is part of Data Segment.
- Brahmananda Reddy December 01, 2009