initialize static variables are stored in data segment
where uninitialized static variables are stored in BSS(block storing for Symbol) it also a part of data segment
exp
static int i=10;//stored in data segment
static int i;//stored in BSS (uninitialized data segment)
Thanks
NAvin
A static variable is one which is not stored on the stack but in the memory of the program. Static variables can be changed.
they are stored in the memory.they obviously can't be stored in stack Bcoz there value won't be retained between function call.
static variables are stored in a special area of the heap called the "permanent generation".
No, static variables are not serialized.
* These are all implementation defined. Access to `register' specified indentifiers should be as fast as possible, so the compiler may place the value in a machine register. However, the compiler is free to treat a `register' declaration as an `auto' declaration. * Where free memory is maintained is an OS specific concept. Instructions are generally stored in code segement. Local Variables are stored in Stack. Register variables are stored in Register. Global & static variables are stored in data segment. The memory created dynamically are stored in Heap And the C program instructions get stored in code segment.
AnswerLocal Variables are stored in Stack. Register variables are stored in Register. Global variables are stored in data segment. The memory created dynamically are stored in Heap And the C program instructions get stored in code segment and the extern variables also stored in data segment. Nooo NoooStatic variable will be stored in .BSS segment... (Block Started By Symbol)
No, a static variable means that there is only one copy of that variable, and it is shared by all members of the class, or by all callers of a function.A variable that is read-only would be marked as const or final (depending on language).
Static functions are tied to a class, not to a particular object. A static function can only access static variables because it has no knowledge of member variables.
No. You will get compilation errors. The complier will complain that you are trying to access non static variables from inside a static method. A static method can access only static variables.
In java we access static variables and static methods without creating objects. i.e.,we can access directly by using classname we can also access static variables and static methods by using objects which are created by using class where the static variables and static methods are available
Auto variables are stored on the stack alongside all other local variables.
Yes, they can