Generally variables are stored in heap memory. When he
variables are created in stack?
Answers were Sorted based on User's Feedback
Answer / vadivelt
It is wrong to say that genarally variables will be stored
in heap memmory.
Bcos Storage area always depends on the storage class of
the variable.
According to the C standard the storage will be.
1.variable with storage class 'auto' ie., local to the
function - in stack memory.
2.variable with storage class 'extern' and 'static' in data
segment.
3.variable with storage class 'register' in processor
register. But this register variable will be treated as
auto when there is no enough memory in the processor.
| Is This Answer Correct ? | 15 Yes | 0 No |
Answer / rohit repale
It is wrong to say that genarally variables will be stored
in heap memmory.
Bcos Storage area always depends on the storage class of
the variable.
If the variables are created by new i.e. dynamic memory is
created then it use heap memory.
static & extern variables are stored in static memory.
And other normal variables are stored in stack.
| Is This Answer Correct ? | 3 Yes | 0 No |
According to the C standard the storage will be.
1.variable with storage class 'auto' ie., local to the
function - in stack memory.
2.variable with storage class when 'extern' and 'static' are initialized stored in data segment otherwise found in bss.
3.variable with storage class 'register' in processor
register. But this register variable will be treated as
auto when there is no enough memory in the processor.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / rahul
I am not sure about this answer but when you pass any
argument to any recursive or non-recursive function.
| Is This Answer Correct ? | 1 Yes | 1 No |
What is the c++ code?
What are disadvantages of pointers?
What c++ library is string in?
Write a struct time where integer m, h, s are its members?
Define inline function
How can we check whether the contents of two structure variables are same or not?
We all know that a const variable needs to be initialized at the time of declaration. Then how come the program given below runs properly even when we have not initialized p?
What is static in c++?
Why c++ does not have finally?
Is c++ pass by reference or value?
How does a copy constructor differs from an overloaded assignment operator?
What do you understand by a pure virtual member function?