GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  C
Go To First  |  Previous Question  |  Next Question 
 C  |  Question 439 of 453    Print  
Memory Stack or Heap
which type of memory(stack or heap)is used by static and external variables?


  
Total Answers and Comments: 6 Last Update: September 01, 2009     Asked by: rajeevpk4 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: impakt
 
"static" variables are hold in the heap memory and "auto" variables are stored on the stack.


Above answer was rated as good by the following members:
sunnyryan, saratchandr
January 09, 2009 07:50:21   #1  
vijay85_ace Member Since: March 2008   Contribution: 1    

RE: Memory Stack or Heap
Both uses the stack memory. heap memory is used by the os.
 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 4Overall Rating: -4    
February 17, 2009 16:23:59   #2  
impakt Member Since: February 2009   Contribution: 2    

RE: Memory Stack or Heap
static variables are hold in the heap memory and auto variables are stored on the stack.

 
Is this answer useful? Yes | NoAnswer is useful 2   Answer is not useful 1Overall Rating: +1    
June 18, 2009 14:19:08   #3  
vivekbansal20 Member Since: June 2009   Contribution: 1    

RE: Memory Stack or Heap
Static varibales are neither stored in stack nor in heap. Static varibales are stored in data segment.

Auto variables are stored in stack and dynamic allocated variables are stored in heap.

 
Is this answer useful? Yes | No
June 25, 2009 05:08:37   #4  
alokag Member Since: June 2009   Contribution: 5    

RE: Memory Stack or Heap
Fully agree with vivekbansal. Static variables (not initialized to value other than 0) are always stored in BSS else in Data of data segment.
 
Is this answer useful? Yes | No
August 10, 2009 14:29:47   #5  
rajatpaliwal86 Member Since: August 2009   Contribution: 1    

RE: Memory Stack or Heap
Heap(Data Segment & BSS(Block start by symbol))
 
Is this answer useful? Yes | No
September 01, 2009 03:14:01   #6  
psjetha Member Since: September 2009   Contribution: 2    

RE: Memory Stack or Heap
Static variables use stack memory.
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape