static, global variable memory allocation



This is an interview question and I gave out my answer here, could you
please check for me?

Q. What are the memory allocation for static variable in a function,
an automatic variable and global variable?

My answer: static variable in function and global variable are
allocated in head, and automatic variable is allocated in stack.

Right?

.



Relevant Pages

  • Re: xmalloc string functions
    ... applications doing complex tasks for which memory allocation failure is only ... applications which do try to handle malloc failure of course). ...
    (comp.lang.c)
  • Re: static memory allocation versus dynamic memory allocation
    ... static memory allocation instead of dynamic memory allocation. ... refer to dynamically allocated space is through a pointer. ...
    (comp.lang.c)
  • Re: Bug in MFC CList?
    ... Compilers do not manage memory allocation; ... exponential allocation algorithm. ... overhead...perhaps an order of magnitude greater than the loop cost. ...
    (microsoft.public.vc.mfc)
  • Re: brk vs mmap vs mmap2
    ... I have decided that brk is the best way to go for private ... This is the code I am now using in the Linux version ... BRK/SBRK is great for simple memory allocation operations, ...
    (alt.lang.asm)
  • Re: Any way to speed up "new"?
    ... > time is spent on the memory allocation, ... > substantially slower compared to the equivalent code written using ... specific size of chunk of memory, ...
    (comp.lang.cpp)