Thread: Stack segment
View Single Post
  #2 (permalink)  
Old April 29th, 2005, 01:59 AM
Alan-LB Alan-LB is offline
Authorized User
 
Join Date: Mar 2005
Posts: 58
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to Alan-LB Send a message via Yahoo to Alan-LB
Default

Yes. Variables declared outside of main() (and any other function) are global and are allocated in the data segment. Variables declared within main() are allocated on the stack as in any other function. The space is released when main() terminates - which is when the program terminates.

Alan


Reply With Quote