Generally variables are stored in heap memory. When he
variables are created in stack?

Answers were Sorted based on User's Feedback



Generally variables are stored in heap memory. When he variables are created in stack?..

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

Generally variables are stored in heap memory. When he variables are created in stack?..

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

Generally variables are stored in heap memory. When he variables are created in stack?..

Answer / suneet

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

Generally variables are stored in heap memory. When he variables are created in stack?..

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

Post New Answer

More C++ General Interview Questions

What do you mean by translation unit in c++?

1 Answers  


What is the use of map in c++?

0 Answers  


What is a binary file? List the merits and demerits of the binary file usagein C++.

0 Answers  


how to swap two numbers with out using temp variable

12 Answers   Global eProcure, TCS,


What are the uses of typedef in a program?

0 Answers  






Can constructor be private in c++?

0 Answers  


Why do we need pointers?

0 Answers  


Why iomanip is used in c++?

0 Answers  


what is difference between internet and Internet?

12 Answers   College School Exams Tests, Microsoft, MIT, TCS,


Write a program which is required to process the time of a clock in hours and minutes, entered from the keyboard. With this program, there are two requirements for any data entered by a user: 1. The data must be of the correct type (in this case, two ints). 2. The data must be in the correct range: this means that, for the minutes, negative numbers and any number above 59 must be rejected; for the hours, negative numbers and any number above 23 must be rejected. Output error message for invalid data input. Output the time one and a half hour after the time input. i.e. Hour: 22 Min: 32 One and a half hour after 22:32 is 00:02

0 Answers  


Why was c++ created?

0 Answers  


What is the topic of the C++ FAQ list?

1 Answers  


Categories